After searching the documents on the Internet for a whole day, I still did not find a solution. I may not find the correct method on the Internet. I just tried to figure it out, but I couldn't figure it out. The next day, I was inspired to find a solution. The method is as follows: import java. io. IOException; import javax. servlet. filter; import javax. servlet. filterChain; import javax. servlet. filterConfig; import javax. servlet. servletException; import javax. servlet. servletRequest; import javax. servlet. servletResponse; public class EncodingFilter implements Filter {public void doFilter (ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {servletRequest. setCharacterEncoding ("UTF-8"); servletResponse. setContentType ("text/html; charset = UTF-8"); filterChain. doFilter (servletRequest, servletResponse);} public void init (FilterConfig arg0) throws ServletException {System. setProperty ("file. encoding "," UTF-8 ");} public void destroy () {}} pay attention to the two red sentences and configure the filter above in xml: <filter> <filter-name> loggerfilter </filter-name> <fil Ter-class> wu. sys. cores. encodingFilter </filter-class> </filter> <filter-mapping> <filter-name> loggerfilter </filter-name> <url-pattern>/* </url-pattern> </filter-mapping> If the operation fails, it may be the browser cache. Clear the cache by yourself.