SpringMvc解决Restful中文乱码问题
中文乱码问题解决方式:
1 <!-- 解决中文乱码问题 --> 2 <filter> 3 <filter-name>CharacterEncodingFilter</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 <init-param> 10 <param-name>forceEncoding</param-name> 11 <param-value>true</param-value> 12 </init-param> 13 </filter> 14 <filter-mapping> 15 <filter-name>CharacterEncodingFilter</filter-name> 16 <url-pattern>/*</url-pattern> 17 </filter-mapping>
如果还是有问题,请将这个filter移动到最前面