SpringMvc解決Restful中文亂碼問題

lonecloud發表於2017-04-10

中文亂碼問題解決方式:

 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>

如果還是有問題,請將這個filter移動到最前面

相關文章