The following is the solution to the garbled URL address transmission parameters shared by you:
1. Configure in tomcat: find the server.xml below conf under the tomcat installation directory and find the following code segment, and modify URIEncoding to GBK;
<Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" URIEncoding="GBK" />
2. Implementation with java:
String username = request.getParameter("userName"); try { username = new String(username.getBytes("iso-8859-1"), "GBK"); } catch (Unsuppor tedEncodingException e1) { e1.printStackTrace(); }
Previously, the editor used this method to solve the problem of garbled Java address parameters. I hope this article can also help you.