我的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>
无论我怎么变换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>
解决方案 »
- 网站出错,大神求职!
- AspectJ表达式问题,急急急.求解答
- 请高手指教
- struts2 jpa(hibernate) spring 启动tomcat报错,急啊
- 主题:用spring作后台框架,用.net的winform作前台可行性探讨
- J2EE读取xml问题,在线等~~
- gSoap异步操作
- 高分求救,在axis 中如何调用 EJB
- XML文件是什么时候生成的?怎么生成的?放在什么地方才可以?每一个都是自己动手一句一句地写的吗?
- 如何调整JB8中的光标???高分!!!!
- mysql中什么类型的字段可以用来存储fckeditor中提交的数据
- Extjs3.0整合ssh时提交表单,总是执行failure函数,不知道为什么,请各位大虾指教!
加上这句 name=new String(name.getBytes("ISO-8859-1"),"gb23112");
对Get提交的用楼上的方法试试