Source code. a. jsp transmits values to B. jsp:
A. jsp page content:
Name:
B. jsp page content:
Symptom: Chinese characters are garbled, such as "???"
The solution is as follows:
Method 1:
1. Change pageEncoding = "GB2312" to pageEncoding = "ISO8859-1" in B. jsp"
Although the content displayed on the B. jsp page is garbled, it is not the type of "???" But some special characters.
2. Check the menu in the browser and modify the code to GB2312. Then, the Garbled text will display Chinese characters.
3. However, this method is not feasible.
Method 2:
1. In B. jsp, change String name = request. getParameter ("name");
String name = new String (request. getParameter ("name"). getBytes ("ISO-8859-1"), "GB2312 ");
2. Then it will be displayed on the page, which is Chinese.
Method 3:
1. Some people say that it is necessary to modify the get/post value transfer method. If you only change the get method to the post method, the page results will still be garbled!
2. You must configure a filter. If you only configure a filter, the value transmission method must be: post is not garbled, and get is garbled!
3. The configuration of the filter, I think everyone can have it. I will not talk about it anymore.
Method 4:
1. Some people say this sentence in the configuration file server. xml for tomcat:
Port = "8080" maxHttpHeaderSize = "8192"
MaxThreads = "150" minSpareThreads = "25" maxSpareThreads = "75"
EnableLookups = "false" redirectPort = "8443" acceptCount = "100"
ConnectionTimeout = "20000" disableUploadTimeout = "true"/>
URIEncoding = "GB2312"
2. Although yes, there are prerequisites. If your filter is not configured, you only Configure the server. xml file, so that you can only pass values in the form with get! When it is post, it is still garbled!
* In this case, we can see that the post and get methods in tomcat5 are different *
* Is there a way to use the get or post method for transferring values? The following is the recommended method 5 *
Method 5:
1. Actually, it is very simple, that is, implementing method 3 and method 4 at the same time!
2. Configure the filter and the server. xml file, both of which are encoded as GB2312.
3. In this way, no text is garbled in form values transmitted through post or get!