POST请求中文乱码问题:
使用CharacterEncodingFilter这个过滤器
在xml文件里配置encoding为utf-8即可
<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><init-param><param-name>forceEncoding</param-name><param-value>true</param-value></init-param></filter><filter-mapping><filter-name>CharacterEncodingFilter</filter-name><url-pattern>/*</url-pattern></filter-mapping>
GET请求中文乱码问题:
修改tomcat的server.xml,在Connector标签后面+ URIEncoding="utf-8"