SpringMVC獲取POST參數值時中文亂碼

spring Web MVC框架提供了org.springframework.web.filter.CharacterEncodingFilter用於解決POST方式形成的中文亂碼問題,只須要在web.xml中配置一個filterweb

<filter>  
    <filter-name>CharacterEncodingFilter</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>CharacterEncodingFilter</filter-name>  
    <url-pattern>/*</url-pattern>  
</filter-mapping>
相關文章
相關標籤/搜索