标签:
1.表单提交一定要指定method,否则下面如何改都没用
2.jsp页面中指定pageEncoding=utf-8,jsp用utf-8来保存
request.setCharacterEncoding("utf-8")
2.使用spring的filter,在web.xml中加入
<filter> <filter-name>encodingFilter</filter-name> <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class> <init-param> <param-name>encoding</param-name> <param-value>UTF-8</param-value> </init-param> </filter> <filter-mapping> <filter-name>encodingFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping>
4.struts.xml中加入常量
<constant name="struts.i18n.encoding" value="UTF-8" />
5.数据库的编码方式改成utf-8
SET NAMES ‘x‘语句与这三个语句等价:
mysql> SET character_set_client = x;
mysql> SET character_set_results = x;
mysql> SET character_set_connection = x;
标签:
原文地址:http://www.cnblogs.com/qingfei1994/p/4282772.html