JavaWeb project garbled problem

There are three places to set the encoding format,

1. It is used to set the encoding format of the webpage sent to the server as UTF-8. Generally, this code will be automatically created.

<%@ page contentType="text/html;charset=UTF-8" language="java" %>

Second, the encoding format of the file sent after the server responds is UTF-8, (the function is to specify the encoding that the server responds to the browser)

If you want to get the Chinese characters of the server response, it is best to write this line of code.

<%
    request.setCharacterEncoding("UTF-8");
%>

Three, the garbled characters in the idea console should be GBK used locally, and UTF-8 used by tomcat.

To solve this problem, you only need to change the encoding in the configuration file in the local tomcat. (Change UTF-8 to GBK)

The other four UTF-8 can also be changed to GBK, which is to set the encoding in the asynchronous file processing program,

The path is in C:\Program Files\Apache Software Foundation\Tomcat 10.1\conf\ logging.properties

Of course, this is only to solve the problem of softness, and the information that should be reported will still be displayed.

 If you don't configure the port to be closed then it will take two clicks to close each time. It's also simple to set up a shutdown port.

Find the local tomcat file server.xml file, change the port -1 in the 21 lines of code to 8081 in the figure below, and that's it.

The path is in C:\Program Files\Apache Software Foundation\Tomcat 10.1\conf\ server.xml

Guess you like

Origin blog.csdn.net/zouzxxi/article/details/131114080