Velocity中文乱码问题解决方法
http://yonge812.iteye.com/blog/1010290 Velocity中文乱码问题需要注意一下几点:
1、eclipse默认编码方式
2、页面的编码方式
3、volocity模板的编码方式
第一步:
- <%@ page language="java" import="java.util.*" pageEncoding="gbk"%>
- 或者
- <filter>
- <filter-name>CharacterEncodingFilter</filter-name>
- <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
- <init-param>
- <param-name>encoding</param-name>
- <param-value>gbk</param-value>
- </init-param>
- </filter>
- <filter-mapping>
- <filter-name>CharacterEncodingFilter</filter-name>
- <url-pattern>/*</url-pattern>
- </filter-mapping>
第三步:
- <!-- 配置velocity引擎 -->
- <bean id="velocityConfigurer"
- class="org.springframework.web.servlet.view.velocity.VelocityConfigurer">
- <!-- 模板路径 -->
- <property name="resourceLoaderPath" value="WEB-INF/velocity/" />
- <property name= "velocityProperties">
- <props>
- <prop key= "input.encoding">gbk</prop>
- <prop key= "output.encoding">gbk</prop>
- </props>
- </property>
- </bean>
- <!-- 配置视图解析器 -->
- <bean id="viewResolver"
- class="org.springframework.web.servlet.view.velocity.VelocityViewResolver">
- <property name="suffix" value=".vm" /><!-- 上面已经指定了模板路径,这里只需定义后缀 -->
- <property name="contentType" value="text/html;charset=gbk"></property> <!-- 设置编码格式 -->
- </bean>
或者
- input.encoding=gbk
- output.encoding =gbk
检查上述几个地方配置是否一致即可。
Velocity中文乱码问题解决方法的更多相关文章
- WingIDE中文乱码问题解决方法
WingIDE中文乱码问题解决方法 安装完WingIDE后,首次运行python脚本时,若脚本中含有UTF-8中文,在Debug I/O输出框中,全部变成了乱码. 这时其实我们设置下WingIDE的编 ...
- 【转】asp.net Cookie值中文乱码问题解决方法
来源:脚本之家.百度空间.网易博客 http://www.jb51.net/article/34055.htm http://hi.baidu.com/honfei http://tianminqia ...
- soapUI参数中文乱码问题解决方法 (groovy脚本中文乱码)
soapUI参数中文乱码问题解决方法 可能方案1: 字体不支持中文,将字体修改即可: file-preferences-editor settings-select font 修改字体,改成能显示中文 ...
- LoadRunner中文乱码问题解决方法
LoadRunner中文乱码问题解决方法 前段时间在录制,增强,整合LoadRunner脚本,期间两次遇到了中文乱码问题.在此记录一下中文乱码问题的解决办法. 一.录制回放中文乱码 我录制登陆的脚本, ...
- python3 库pandas写入csv格式文件出现中文乱码问题解决方法
python3 库pandas写入csv格式文件出现中文乱码问题解决方法 解决方案: 问题是使用pandas的DataFrame的to_csv方法实现csv文件输出,但是遇到中文乱码问题,已验证的正确 ...
- soapUI参数中文乱码问题解决方法&soap UI工具进行web接口测试
soapUI参数中文乱码问题解决方法 可能方案1: 字体不支持中文,将字体修改即可: file-preferences-editor settings-select font 修改字体,改成能显示中文 ...
- tomcat启动控制台中文乱码问题解决方法
tomcat启动控制台中文乱码问题解决方法,修改tomcat安装路径/conf/logging.properties文件 java.util.logging.ConsoleHandler.encodi ...
- tomcat项目中文乱码问题解决方法
在部署tomcat项目时经常会遇到中文乱码问题,解决的方法可参考以下步骤. 1.更改Tomcat安装目录下的conf\server.xml,指定浏览器的编码格式为"utf-8"格式 ...
- JSP中文乱码问题解决方法小结
在使用JSP的过程中,最使人头疼的一个问题就是中文乱码问题,以下是我在软件开发中遇到的乱 码问题以及解决方法. 1.JSP页面乱码 这种乱码的原因是应为没有在页面里指定使用的字符集编码,解决方法:只要 ...
随机推荐
- The number of steps(概率dp)
Description Mary stands in a strange maze, the maze looks like a triangle(the first layer have one r ...
- Codeforces Round #424 B. Keyboard Layouts(字符串,匹配,map)
#include <stdio.h> #include <string.h> ][]; ]; ]; int main(){ scanf(]); scanf(]); scanf( ...
- codeforces Round #440 C Maximum splitting【数学/素数与合数/思维/贪心】
C. Maximum splitting time limit per test 2 seconds memory limit per test 256 megabytes input standar ...
- D - Interesting Calculator 【数值型BFS+优先队列】
There is an interesting calculator. It has 3 rows of buttons. Row 1: button 0, 1, 2, 3, ..., 9. Pres ...
- HDU 多校1.8
- numeric column can contains null
- Reference resources
CentOS7 (精简操作指令) http://www.centoscn.com/CentOS/help/2016/0429/7147.html
- [P2396] yyy loves Maths VII
Link: P2396 传送门 Solution: 一眼能看出$O(n*2^n)$的状压$dp$ 但此题是个卡常题,$n=23/24$的时候就别想过了 这题算是提供了一种对状压$dp$的优化思路吧 原 ...
- 【对询问分块】【主席树】bzoj2683 简单题
对操作序列分块,每S次暴力重建主席树. 当S=sqrt(n*log(n))时,复杂度为O(m*sqrt(n*log(n))). 在线的. #include<cstdio> #include ...
- python3-开发面试题(python)6.22基础篇(1)
1.为什么学习Python? 1.语言排行榜 2.语言本身简洁,优美,功能超级强大的 3.跨平台 4.非常火爆的社区 5.用的公司的多 2.通过什么途径学习的Python? 某宝2.8就搞定了,跟着视 ...