Source code, a.jsp to b.jsp value:
a.jsp Page Content:
<%@ page language= "java" import= "java.util.*" pageencoding= "GB2312"%>
<form action= "b.jsp" >
Name:<input Type=text name=name>
<input type=submit>
</form>
b.jsp Page Content:
<%@ page language= "java" import= "java.util.*" pageencoding= "GB2312"%>
<%
String name=request.getparameter ("name");
%>
<body>
<%=name%>
</body>
Phenomenon: Chinese garbled, such as "?????? ”
The workaround is as follows:
Method One:
1. In b.jsp, replace pageencoding= "GB2312" with pageencoding= "Iso8859-1"
Although this b.jsp page display content or garbled, but not the kind of "?????? "The garbled, but some special characters
2. Then in the browser to see the menu modified into GB2312 code, then garbled display in Chinese.
3. However, this method is not feasible.
Method Two:
1. In the b.jsp string name=request.getparameter ("name");
String Name=new string (Request.getparameter ("name"). GetBytes ("Iso-8859-1"), "GB2312");
2. Then the display on the page, it is Chinese.
Method Three:
1. It is said to modify the value of Get/post, but this is a prerequisite, if only the get way to modify the post method, the page result or garbled!
2. The premise you must configure the filter, if you just configured the filter, then the value must be the way: Post way is not garbled, if the get way is still garbled!
3. The configuration of the filter, I think we can all have, I will not say
Method Four:
1. It was said that configuring Tomcat's configuration file server.xml this sentence:
<connector uriencoding= "GB2312"
port= "8080" maxhttpheadersize= "8192"
maxthreads= "minsparethreads=" maxsparethreads= "75"
Enablelookups= "false" redirectport= "8443" acceptcount= "100"
connectiontimeout= "20000" disableuploadtimeout= "true"/>
Add this sentence: uriencoding= "GB2312"
2. Although it can but have the prerequisite, if you do not configure the filter, it is only configured server.xml files, so only in the form of Get pass value only when it can! When it is the Post method, it is still garbled!
* Then we can see that the post in TOMCAT5 is not the same as the Get pass value
* Someone wants to ask if there is a way to make the value of the pass using Get method or Post method, the following is the method I recommend five *
Method Five:
1. In fact very simple, is the simultaneous implementation of the three methods and implementation of the method four!
2. Is to configure the filter first, and configure the Server.xml file, are set to GB2312 encoding
3. So no matter is the post or get way table conveys value, Chinese will not be garbled!