post乱码:
1.在web.xml中配置
<filter>
<filter-name>CharacterEncodingFilter</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>CharacterEncodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
2.
get乱码:
1.在tomcat配置文件中配置
2.在java代码中设置:例如
queryString=new String(queryString.getBytes("iso-8859-1"),"utf-8");