首页 > 代码库 > spring mvc中文乱码问题

spring mvc中文乱码问题

  1. 如果是post,在web.xml中加上
  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. </filter>  
  10. < filter-mapping>  
  11.     < filter-name>CharacterEncodingFilter</filter-name>  
  12.     < url-pattern>/*</url-pattern>  
  13. < /filter-mapping>
  14. 如果是get,需要修改Tomcat根式目录的 conf/server.xml文件中,在里面加uRIEncoding="utf-8"

spring mvc中文乱码问题