1. Configure the filter in the web.xml file and add the following code:
<filter>
<filter-name>CharacterEncoding</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>CharacterEncoding</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
2. The JSP page needs to write the encoding format in the form of utf-8
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
3. Add URIEncoding="UTF-8" to tomcat:
<Connector connectionTimeout="20000" port="8080" protocol="HTTP/1.1" redirectPort="8443" URIEncoding="UTF-8"/>
This file is in the server.xml document in the Servers directory.