2013-07-04 62 views
0

我有一些問題,以添加UTF-8到我現有的項目。春季添加一個額外的過濾器

我已經看到了在這個崗位utf-8 spring

但在我的web.xml中的解決方案,我有春天保安過濾器,所以我怎麼能包括我的web.xml中另一個過濾器?

的web.xml

<filter> 
    <filter-name>springSecurityFilterChain</filter-name> 
    <filter-class> 
     org.springframework.web.filter.DelegatingFilterProxy 
    </filter-class> 
</filter> 

<filter-mapping> 
    <filter-name>springSecurityFilterChain</filter-name> 
    <url-pattern>/*</url-pattern> 
</filter-mapping> 

我需要包括這些新的線(以允許UTF-8編碼)

<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> 
    <init-param> 
    <param-name>forceEncoding</param-name> 
    <param-value>true</param-value> 
    </init-param> 
</filter> 
<filter-mapping> 
    <filter-name>encodingFilter</filter-name> 
    <url-pattern>/*</url-pattern> 
</filter-mapping> 

回答