在三大框架spring中有专门的一个过滤器类用于处理乱码问题--->CharacterEncodingFilter
我们只需在web.xml中添加如下几行代码就可解决乱码问题
<filter>
<filter-name>encoding</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>encoding</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>