Loading... ## SpringMVC post方式中文乱码问题处理 SpringMVC会拦截所有请求,并完成cotrol方法形参的填充。我们需要在这之前完成对请求参数的值进行编码,在web.xml中设置一个字符串编码处理拦截器,设置字符串编码并开启字符串编码设置。 ```xml <!-- 配置SpringMVC设置编码方式的过滤器 --> <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> <init-param> <param-name>forceRequestEncoding</param-name> <param-value>true</param-value> </init-param> <init-param> <param-name>forceResponseEncoding</param-name> <param-value>true</param-value> </init-param> </filter> ``` Last modification:December 25, 2020 © Allow specification reprint Support Appreciate the author AliPayWeChat Like 0 感谢大佬投喂 啾咪~