传值乱码解决方案
1、在web.xml中配置编码方式
<!-- spring Web MVC框架提供了org.springframework.web.filter.CharacterEncodingFilter用于解决POST方式造成的中文乱码问题 -->
<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>
<!-- 处理中文乱码问题 start
<filter>
<filter-name>UTF-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>
<init-param>
<param-name>forceEncoding</param-name>
<param-value>true</param-value>
</init-param>
</filter><filter-mapping>
<filter-name>UTF-Encoding</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping> -->
2)接收的地方在上编码方式
request.setCharacterEncoding("utf-8");
response.setCharacterEncoding("utf-8");
response.setContentType("text/html;charset=utf-8");
3)在tomcat中server.xml的端口号后面加上
<Connector connectionTimeout="20000" port="8081" protocol="HTTP/1.1" redirectPort="8443" URIEncoding ="UTF-8"/>
4)热部署下ajax传值乱码
<configuration>
<port>8088</port>
<path>/</path>
<uriEncoding>UTF-8</uriEncoding>
</configuration>