我写了一个JSP测试页面,可传入的中文参数怎么就成了问号呢?我己经设置了:request.setCharacterEncoding("GBK");大家帮我看看: 小弟刚学希望把原因说得具体点,谢了!!!<%@ page contentType="text/html; charset=GBK"%><html>
<head>
<title>My JSP</title>
</head>
<body>
<center>
<h3>request对象获取GET方法上的变量</h3>
<table border="0" width="60%" cellpadding="5">
<form method="get" action="requestget.jsp">
<tr>
<td>名字:</td><td><input type="TextField" name="name" value=""></td>
</tr>
<tr>
<td>联系地址:</td><td><input type="TextField" name="address" value=""></td>
</tr>
<tr>
<td>邮编:</td><td><input type="TextField" name="zipcode" value=""></td>
</tr>
<tr align="center">
<td><input type="submit" name="submit" value=" 提 交 "></td>
<td><input type="reset" name="reset" value=" 重 写 "></td>
</tr>
<%request.setCharacterEncoding("GBK");%>
<tr>
<td>名字:</td><td><%=request.getParameter("name") %></td>
</tr><tr>
<td>联系地址:</td><td><%=request.getParameter("address") %></td>
</tr><tr>
<td>邮编:</td><td><%=request.getParameter("zipcode") %></td>
</tr>
</table>
</center>
</body>
</html>
name=new String(name.getbyte("iso=8859-1"),"gb2312")
就可以了 重新编码下就行
name=new String(name.getbyte("iso-8859-1"),"gb2312")