JSP中页面的请求响应的乱码有关问题

JSP中页面的请求响应的乱码问题

http://www.mossle.com/docs/jsp/html/index.html

 

index.jsp

<%@ page contentType="text/html; charset=gb2312" %>
<html>
	
	<head>
	<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
	<title>中文显示示例</title>
	</head> 
	<body>
	<form action="test.jsp" method="POST">
    	用户名 : <input type="text" name="username" />
    <br />
    <input type="submit">
	</form>
	</body>
</html>

 test.jsp

<%@ 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("username")%>
   </body>
</html>