请求处理乱码问题
1.GET请求乱码
配置tomcat,设置URIEncoding=utf-8
Tomcat 文件夹中conf目录下,修改server.xml文件如下:
2.POST请求乱码
Web.xml中配置编码过滤器
<filter>
<filter-name>characterFilter</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>characterFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>