解决UTF-8方法归纳

1:通过spring配置过滤器解决

 

    <!-- 配置Spring提供的字符编码过滤器 -->
    <filter>
        <filter-name>SpringCharacterEncodingFilter</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>SpringCharacterEncodingFilter</filter-name>
        <url-pattern>*.do</url-pattern>
    </filter-mapping>

 

posted @ 2017-05-16 17:44  开文博客园  阅读(259)  评论(0编辑  收藏  举报