post请求中文乱码解决方式

在web.xml文件中配置编码格式过滤器

<!--监听编格式-->
  <!--解决post请求乱码问题-->
  <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>

 

posted @ 2020-06-19 16:05  JAVA_宇  阅读(1463)  评论(0编辑  收藏  举报