注意页面的编码也要统一(比如统一设置为utf-8)
通过设置tomcat的get请求的编码
找到自己的tomcat路径
D: omcat7apache-tomcat-7.0.86-windows-x64apache-tomcat-7.0.86conf
打开server.xml文件,
在web.xml中添加过滤器,过滤post的请求编码
1 <!-- 过滤post请求的编码 --> 2 <filter> 3 <filter-name>encoding</filter-name> 4 <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class> 5 <init-param> 6 <param-name>encoding</param-name> 7 <param-value>utf-8</param-value> 8 </init-param> 9 </filter> 10 <filter-mapping> 11 <filter-name>encoding</filter-name> 12 <url-pattern>/*</url-pattern> 13 </filter-mapping>