标签:
jsp页面中文输入,到controller乱码,这时候需要设置的是在web.xml文件中添加一个编码的过滤器(filter)将编码统一为UTF-8。代码:
<!-- jsp提交中文表单,controller中解决中文乱码问题--> <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>
标签:
原文地址:http://www.cnblogs.com/sunada2005/p/4824529.html