首页 > 代码库 > Spring MVC传值乱码解决

Spring MVC传值乱码解决

在web.xml中进行配置,加入以下代码:

 1 <!-- 乱码解决 -->
 2   <filter>  
 3         <filter-name>characterEncodingFilter</filter-name>  
 4         <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>  
 5         <init-param>  
 6             <param-name>encoding</param-name>  
 7             <param-value>UTF-8</param-value>  
 8         </init-param>  
 9         <init-param>  
10             <param-name>forceEncoding</param-name>  
11             <param-value>true</param-value>  
12         </init-param>  
13     </filter>  
14     <filter-mapping>  
15         <filter-name>characterEncodingFilter</filter-name>  
16         <url-pattern>/*</url-pattern>  
17     </filter-mapping>  

 

Spring MVC传值乱码解决