SpringForm表单提交修改TomcatUTF8编码无效问题排查

编程

1、tomcat 配置server.xml

  <Connector port="8080" protocol="HTTP/1.1"

connectionTimeout="20000"

URIEconding="UTF-8"

useBodyEncodingForURI="true"

redirectPort="8443" />

2、检查项目web.xml是否配置字符编码过滤器(可解决中文乱码问题)

  <filter>

<filter-name>encodingFilter</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>forceEncoding</param-name>

<param-value>true</param-value>

</init-param>

</filter>

<filter-mapping>

<filter-name>encodingFilter</filter-name>

<url-pattern>/*</url-pattern>

</filter-mapping>

3、检查文件编码格式是否为UTF-8。

以上是 SpringForm表单提交修改TomcatUTF8编码无效问题排查 的全部内容, 来源链接: utcz.com/z/510881.html

回到顶部