我的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>
解决方案 »
- 小弟新手 请教关于服务器端验证码 验证的问题。。。。
- 在线等...spring配置时,cvc-complex-type.2.4.c:错误???
- 关于jsp字符问题
- 请教一个问题
- 两个非Java系统用JMS通讯合理吗?如何做啊?
- EJB 的问题各位高手帮看看
- CSDN还能不能开了
- struts表单,两个提交按钮(下一步,完成).怎么把它们区分开来?
- 应用服务器为WEBLOGIC,用JBuilder 9做了个JSP测试项目,并用JBuilder发布时候有错误发生,初学多帮忙
- mybatis的not in和in问题
- mysql中什么类型的字段可以用来存储fckeditor中提交的数据
- Extjs3.0整合ssh时提交表单,总是执行failure函数,不知道为什么,请各位大虾指教!
加上这句 name=new String(name.getBytes("ISO-8859-1"),"gb23112");
对Get提交的用楼上的方法试试