String password = request.getParameter("password").getBytes("ISO-8859-1");
试试

解决方案 »

  1.   

    你试试在jsp文件中加上这么一句话
    <%@ page contentType="text/html;charset=gb2312"%>
    <%
       request.setCharacterEncoding("gb2312");
      String name = request.getParameter("name");
      String password = request.getParameter("password");
      out.print("name:"+ name+"<br>");
      out.print("password;"+password+"<br>");%>
      

  2.   

    或者如上面那个朋友说的那种方法也可以
    String name = new String(request.getParameter("name").getBytes("ISO-8859-1"),"gb2312") ;
      

  3.   

    request.setCharacterEncoding("gb2312"); 不是什么时候都管用的,建议两点
    1,用filter
    2,new String(request.getParameter("password").getBytes("iso-8859-1"),"gbk");
      

  4.   

    new String(request.getParameter("password").getBytes("iso-8859-1"),"gbk");放在filter里  效果很好
      

  5.   

    怎么叫不是什么时候都管用?我一般jsp页面之间都弄一个Servlet,在servlet中使用
    request.setCharacterEncoding("gb2312");到现在还没出现不能显示的问题!
      

  6.   

    很简单,我就不给你贴代码啦,就告诉你方法吧:你用DreamWare建一个jsp页面,然后查看源代码,最顶的代码就是解决中文问题的啦。
      

  7.   

    <%@ page contentType="text/html;charset=gb2312"%>
      

  8.   

    TO:libin19830213(游戏与娱乐) 
    new String(request.getParameter("password").getBytes("iso-8859-1"),"gbk");
    只能将password参数转换为中文,但对于其他得参数都必须这样写,太麻烦了,如果在filter里写能够重用得代码该怎么写?
    我试过在filter里写request.setCharacterEncoding("gb2312")不管用,但jrunner()说在servlet中使用
    request.setCharacterEncoding("gb2312");到现在还没出现不能显示的问题!搞不懂到底是哪儿得事?
      

  9.   

    最好不用GB2312,都用GBK。因为GBK的词库比GB2312的要大很多。
    另外把 out.print 改为 out.write(按字符写)。PS:不过如果是通过表单接受参数的话,这个方法好像只对POST方法适用,GET方法显示还是不能正常。
      

  10.   

    直接用UTF-8,文件保存类型也选择UTF-8,应该没问题的,最好还加一个Filter
      

  11.   

    如楼上所说: UTF-8是最佳选择,同时加个过滤器