Monday, April 11, 2016

Spring Web character encoding

web.xml

Use filter:  org.springframework.web.filter.CharacterEncodingFilter provided by spring.


 <!-- Encoding with spring filter -->
 <filter>
  <filter-name>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>
 </filter>
 <filter-mapping>
  <filter-name>encoding</filter-name>
  <url-pattern>/*</url-pattern>
 </filter-mapping>

No comments:

Post a Comment