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

解决方案 »

  1.   

    如果是你写在jsp中的中文不能显示就像楼上那样,把charset设成gb2312
    如果是传进来的中文不能正常显示
    byte[] temp = "中文".getBytes("ISO8859-1");
    String s = new String(temp);
    其实这个问题有很多一样的贴子,你搜索一下也许会有很多的收获:)
      

  2.   

    1:在jsp页面加入:  
    <%@  page  contentType="text/html;  charset=gb2312"  %>  
     2:在servlet里面:  
       public  void  doGet(HttpServletRequest  request,  HttpServletResponse  response)  throws  ServletException,  IOException  {  
           response.setContentType("text/html;  charset=gb2312");//这是重要的  
     
    3:上面的如果在不行就用如下的方法在数据入库前进行调用:  
    public  static  String  UnicodeToChinese(String  s){  
       try{  
             if(s==null  &brvbar;  &brvbar;s.equals(""))  return  "";  
             String  newstring=null;  
             newstring=new  String(s.getBytes("ISO8859_1"),"gb2312");  
             return  newstring;  
           }  
       catch(UnsupportedEncodingException  e)  
       {  
       return  s;  
       }  
       }  
     
    public  static  String  ChineseToUnicode(String  s){  
       try{  
       if(s==null  &brvbar;  &brvbar;s.equals(""))  return  "";  
       String  newstring=null;  
       newstring=new  String(s.getBytes("gb2312"),"ISO8859_1");  
         return  newstring;  
       }  
       catch(UnsupportedEncodingException  e)  
       {  
       return  s;  
     }  
       }
      

  3.   

    简单一点的办法是在页首添加下面这几句话:
    <%@ page contentType="text/html;charset=GBK" %>
    <% request.setCharacterEncoding("gb2312"); %>
    <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb2312">