在jsp页面中加入:
<%@ page contentType="text/html;charset=gb2312" %>

解决方案 »

  1.   

    加入
    <%@ page contentType="text/html; charset=GBK" %>
    <%request.setCharacterEncoding("GBK");%>
    这样就OK了
      

  2.   

    both of them are ok<%@ page contentType="text/html; charset=gb2312" %>
      

  3.   

    如果上面的两种方法都不行,
    你就要用
    a =new String (a.getBytes("iso8859-1"),"gbk");
      

  4.   

    Servlet:
    response.setContentType("text/html;charset=gb2312");
      

  5.   

    自己写个函数:<%!
    public String getStr(String str){
    try{
    String temp_p=str;
    byte[] temp_t=temp_p.getBytes("ISO8859-1");
    String temp=new String(temp_t);
    return temp;
    }
    catch(Exception e){}
    return "null";
    }
    %>调用:username=request.getParameter("name");
    username=getStr(username);