标签:
<HEAD>
...
<META http-equiv=Content-Type content="text/html;charset=gb2312">
...
<HEAD>
<%@ page contentType="text/html;charset=gb2312" language="java"%>
response.setCharacterEncoding("gb2312");
<!--定义编码过滤器-->
<filter>
<filter-name>encodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>gb2312</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>encodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
String param = request.getParameter("param");
param = new String(param.getBytes("ISO-8859-1", "GB2312"));
也可以通过修改Tomcat的server.xml文件来解决:
<Connector port = "8080"
...
URIEncoding="GB2312"/> -->增加这项
jdbc:mysql://localhost/test?user=root&password=123456&useUnicode=true&characterEncoding=gb2312
标签:
原文地址:http://www.cnblogs.com/fcm888/p/5362925.html