springMVC中 POST 请求数据变乱码问题

web.xml中配置字符编码过滤器

<!-- 解决POST请求数据乱码问题 -->
<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>

 

posted @ 2020-09-20 23:19  青青鸟  阅读(147)  评论(0编辑  收藏  举报