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"
posted @ 2017-06-03 15:59  lszan  阅读(97)  评论(0编辑  收藏  举报