解决Spring MVC中文乱码

在web.xml中设置编码过滤器

<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>
    <servlet-name>appServlet</servlet-name>
</filter-mapping>

 

posted @ 2016-04-03 19:33  Yuan丶野幻想  阅读(144)  评论(0编辑  收藏  举报