1、乱码的解决
如果要解决GET需要在server.xml里面配置或者自定义filter
通过过滤器
SpringMvc提供了characterEncodingFilter解决POST乱码问题
直接在web.xml配置filter:
<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>
</filter>
<filter-mapping>
<filter-name>characterEncodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
网友评论