zoukankan      html  css  js  c++  java
  • Spring velocity 中文乱码 解决方案

    主要有这么几步,在spring web 的  [sevlet-name]-servlet.xml文件中,修改为:

    黑体字体为关键,其它根据你的实际情况配置:

      <!-- ========================= VIEW DEFINITIONS ========================= -->
         <bean id="velocityViewResolver" class="org.springframework.web.servlet.view.velocity.VelocityViewResolver">
            <property name="suffix" value=".vm"></property>
            <property name="contentType"><value>text/html;charset=UTF-8</value></property> 
        </bean>
        
        <bean id="velocityConfigurer" class="org.springframework.web.servlet.view.velocity.VelocityConfigurer">
            <property name="resourceLoaderPath">
                <value>${pgallery.template}</value>
            </property>
            <property name="velocityProperties">
                <props>
                    <prop key="input.encoding">utf-8</prop>
                    <prop key="output.encoding">utf-8</prop>
                </props>
            </property> 

        </bean>

    注:

    首先要保证开发环境的文件编码统一,将jsp/html的字符编码都声明为utf-8。

  • 相关阅读:
    I
    poj 3414 pots (bfs+路径记录)
    hdoj 1495 非常可乐(bfs)
    hdoj 1241 Oil Deposits (dfs)
    hdoj 2612 find a way (两次bfs)
    poj 3984 迷宫问题
    poj 3087 Shuffle'm Up (bfs)
    poj 3126 Prime Path (bfs)
    poj 3279 Fliptile
    hdu_3068 最长回文(Manacher算法)
  • 原文地址:https://www.cnblogs.com/netcorner/p/4310353.html
Copyright © 2011-2022 走看看