spring4 mvc中文乱码解决

 

在web.xml中添加
org.springframework.web.filter.CharacterEncodingFilter用于解决POST方式造成的中文乱码问题

  1. <filter>
  2. <filter-name>CharacterEncodingFilter</filter-name>
  3. <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
  4. <init-param>
  5. <param-name>encoding</param-name>
  6. <param-value>utf-8</param-value>
  7. </init-param>
  8. </filter>
  9. <filter-mapping>
  10. <filter-name>CharacterEncodingFilter</filter-name>
  11. <url-pattern>/*</url-pattern>
  12. </filter-mapping>

未经允许不得转载:Java爱好者 » spring4 mvc中文乱码解决

赞 (0) 打赏