标签:
1、现象:后台从jsp读取值乱码
解决办法:在web.xml文件中添加:
<!-- 解决后台读取jsp乱码问题 --> <filter> <filter-name>encodingFilter</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>encodingFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping>
2、在1的基础上,如果录入数据库还是乱码,打开数据库,将格式改为utf-8,如下:
标签:
原文地址:http://www.cnblogs.com/gugibv/p/5230398.html