Home>

The following is a solution to the garbled url address transmission parameters shared by everyone:

1. Configure in tomcat:find the following code snippet under server.xml under conf under the tomcat installation directory,Modify the uriencoding to gbk;

<connector port="8080" protocol="http/1.1"
connectiontimeout="20000" redirectport="8443" uriencoding="gbk" />

2. Implemented in java:

string username=request.getparameter ("username");
try {
  username=new string (username.getbytes ("iso-8859-1"), "gbk");
}
catch (unsupportedencodingexception e1) {
  e1.printstacktrace ();
}

Previously, we used this method to solve the problem of garbled java address parameters.Hope this article can help everyone.

Related articles

  • Previous Detailed usage of isAlive () and join () in Java thread programming
  • Next Detailed Java thread priorities and deadlocks