The URL parameter in tomcat is Chinese. garbled characters are displayed after the servlet receives the request.
When the parameter value in the URL is a text, the received servlet displays garbled characters, such:
Modify the server. xml file in tomcat. The file path is the conf folder under the tomcat installation directory. Is the server. xml file before modification.
The modified server. xml file. Added a line: URIEncoding = "UTF-8"
Restart the tomcat server after modification, and then test the operation.
Use request. setCharacterEncoding ("UTF-8"); To set the encoding format for Tomcat to receive requests,
Only valid for data submitted in POST mode and invalid for data submitted in GET mode!
To set the GET encoding, you can modify the server. in the xml file, the Connector attribute of the corresponding port: URIEncoding = "UTF-8", so that the data submitted in GET mode will be decoded correctly.