jsp乱码问题求解决
我的jdk1.7 tomcat7.0
无论我怎么变换charset的只有post是中文,无论我怎样去掉三个charset设置,要么都不是中文,要么只有post方式是中文,
求帮助。
下面是测试程序
<%@ page language="java" contentType="text/html; charset=GB2312"
pageEncoding="GB2312"%>
<%
request.setCharacterEncoding("GB2312");
String action=request.getParameter("action");
if(action !=null && action.trim().equals("action")){
String name=request.getParameter("name");
out.println(name);
System.out.println(name);
}
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GB2312">
<title>Insert title here</title>
</head>
<body>
<form action="Test.jsp" method="get">
<input type="hidden" name="action" value="action">
<table>
<tr>
<td>
<input type="text" name="name" value="我是get">
</td>
<td>
<input type="submit" value="提交get">
</td>
</tr>
</table>
</form>
<form action="Test.jsp" method="post">
<input type="hidden" name="action" value="action">
<table>
<tr>
<td>
<input type="text" name="name" value="我是post">
</td>
<td>
<input type="submit" value="提交post">
</td>
</tr>
</table>
</form>
<a href="Test.jsp?action=action&name=我是herf">我是href</a>
</body>
</html>
------解决方案--------------------