一、页面编码
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
二、URL中的乱码
修改tomcat中server.xml中Connector的port=“8080”,加上一个 URIEncoding=”utf-8”
三、配置过滤器,指定所有请求的编码
<!-- springmvc的乱码过滤器-->
<filter>
<filter-name>encodingFilter</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>encodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>