JSP page passing parameters in the URL will appear garbled
The workaround is as follows:
First, use the method of changing Tomcat. This method is simple, but need to change the location of the server software level, if a slight change in the system will not be correct transcoding, the transplant is not high.
1, came to the Tomcat directory, to find the server.xml price, open, find the label, in the final add uriencoding= ' GBK ', the effect is as follows:
View Plaincopy to Clipboardprint?
port= "8080" maxthreads= "minsparethreads=" maxsparethreads= "75"
Enablelookups= "false" redirectport= "8443" acceptcount= "100"
debug= "0" connectiontimeout= "20000"
Disableuploadtimeout= "true" uriencoding=″gbk″/>
This method tests success on Get this method.
2. Add the following code to each JSP page
View Plaincopy to Clipboardprint?
<% @pagepageEncoding = "gb2312″%>
<% @pagecontentType = "text/html;charset=gb2312″%>
<%request.setcharacterencoding ("Gb2312″");%>
<%@ page pageencoding= "gb2312″%><%@ page contenttype=" text/html;charset=gb2312″%><% Request.setcharacterencoding ("Gb2312″");%>
The encoding method can also be changed to GBK, which supports traditional Chinese. Reboot Tomcat, this step is important, otherwise you may not see the effect.
This method succeeds for the post test. Two kinds of synchronous use are recommended.
Second, the use of JSP Scriptlet
View Plaincopy to Clipboardprint?
<%=newstring (Elvalue.getbytes ("iso-8859-1"), "GBK")%>
<%=new String (elvalue.getbytes ("iso-8859-1"), "GBK")%>
Iii. Use of custom Jstl
This is our focus, here to explain.
First, write a custom label
Second, write tag file
Third deployment Tag file
Use it four; it's simple.