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>