Everyone in the development process of JSP, often the problem of Chinese garbled, may be one to haunt you, I am now in the development of JSP encountered in Chinese garbled problems and solutions to write for your reference.
One, JSP page display garbled
The following display page (display.jsp) will appear garbled:
<TITLE>JSP's Chinese processing </title>
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 ">
<body>
<%
Out.print ("Chinese Processing of JSP");
%>
</body>
For different Web servers and different JDK versions, the processing results are not the same. Reason: The server uses different encoding methods and browsers to different characters display results. Workaround: Specify the Encoding (GB2312) in the JSP page, that is, the first line of the page plus:
English Code <%@ page contenttype= "text/html; charset=gb2312 "%>
You can eliminate the garbled. The complete page is as follows:
<%@ page contenttype= "text/html; charset=gb2312 "%>
<TITLE>JSP's Chinese processing </title>
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 ">
<body>
<%
Out.print ("Chinese Processing of JSP");
%>
</body>
Second, the form submitted in Chinese when there are garbled
Below is a submission page (submit.jsp) with the following code:
<TITLE>JSP's Chinese processing </title>
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 ">
<body>
<form name= "Form1" method= "Post" action= "process.jsp" >
<div align= "center" >
<input type= "text" name= "name" >
<input type= "Submit" name= "submit" value= "Submit" >
</div>
</form>
</body>