下面是一个提交页面(submit.jsp),代码如下:
<html>
<head>
<title>JSP的中文处理</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<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>
</html>
//下面是处理页面(process.jsp)代码:
<%@ page contentType="text/html; charset=gb2312"%>
<html>
<head>
<title>JSP的中文处理</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body>
<%=request.getParameter("name")%>
</body>
</html>
<%@ page contentType="text/html; charset=gb2312"%> <% request.setCharacterEncoding("gb2312"); %> <html> <head> <title>JSP的中文处理</title> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> </head> <body> <%=request.getParameter("name")%> </body> </html>
原文:http://www.cnblogs.com/amwuau/p/6210529.html