[求助]关于显示中文的问题
前台是:<form action="C.jsp" method="post">
用户名:<input name="name" type="text"><br>
爱好:<input name="favorite##" type="checkbox" value="跑步">跑步
<input name="favorite##" type="checkbox" value="跳舞">跳舞
<input name="favorite##" type="checkbox" value="体操">体操
<input type="submit" value=" o k ">
</form>
后台是:
Enumeration en = request.getParameterNames();
request.setCharacterEncoding("gbk");
while(en.hasMoreElements())
{
String name = (String)en.nextElement();
if(name.endsWith("##"))
{
String favoritename[] = request.getParameterValues(name);
for(int i = 0;i<favoritename.length;i++)
{
//favoritename[i] = new String(favoritename[i].getBytes("ISO-8859-1"),"GBK");
out.println(favoritename[i]);
}
}else
{
String strname = request.getParameter("name");
out.print(strname);
}
}
用红颜色的代码转换都是显示乱码,网页已经设置成gbk了
麻烦大家了