如果使用是网页地址get方式请求传输中文字符的话,springmvc会出现乱码的问题,这时候需要在web。xml中配字符拦截器(ps:仅对post请求有效果)
----------------------------------------------------------------------------------------------------------------------------
<!-- 配置编码过滤器,解决中文乱码问题:页面需设置utf-8,提交方式需为:post否则无法拦截 -->
<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>
<init-param>
<param-name>forceEncoding</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>characterEncodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
----------------------------------------------------------------------------------------------------------------------------