The combined query function is originally submitted using the <HTML: Form> POST method by default. After the paging function is added, the user-submitted query content (for example, http: // localhost: 8080/aims/client/filter. do? Name = % E5 % BC % A0 & Address = % E5 % 8C % 97% E4 % Ba % AC & Title = & duty = & departmentcode = 10000001 & categorycode = 10000002 & fieldcode = 10000006 & amp; gendercode = & amp; identitycode = ), therefore, the form submission method should be changed to get.
Simply change to method = "get", but this change makes the action unable to get the correct input value. For example, if you enter "Zhang" in the name condition, use theform in the action. getname () will get garbled characters such as "% A4". Not only are the query results incorrect, but garbled characters are also displayed in the name column of the re-display query form.
I tried a lot of transcoding is not converted into the original value, asked a lot of friends, the final solution is still through the conversion of encoding, is to convert the ISO8859-1 to UTF-8, that is, string name = new string (theform. getname (). getbytes ("ISO8859-1"), "UTF-8");, pay attention to my applicationsProgramThe encoding filter for the UTF-8 is used.
Although manual transcoding is requiredCodeIt's not good, but it's only here. My current environment is Tomcat + MySQL. I don't know if there will be any garbled code on another server. Fortunately, this issue does not need to be considered in this project.
It is said that Tomcat processes post and get requests in a different way. in XML, the <connector> Add uriencoding = "GBK" attribute, but I try to make a difference.