<%response.setContentType("text/html;charset=gb2312");
  request.setCharacterEncoding("gb2312");%>
兄弟,加上这个试试。

解决方案 »

  1.   

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

  2.   

    这些我都试过了,
    <%@ page contentType="text/html; charset=gb2312" %>我还试了n种组合
    比如<%@ page contentType="text/html; charset=GBK" %>什么的
    两个页面排列组合,还是不行啊不过还是很感谢你们
      

  3.   

    改web.xml的内码设置,如utf-8改为gb2312.
      

  4.   

    写一个函数,用于转换中文就行了,到时哪里需要用到中文就用这个函数把它包装了,
    需要用到GBK编码?
      

  5.   

    插入以下的语句
    isnull = new String(isnull.getBytes("iso-8859-1"),"GBK");
    即可但是jackal123 (卖女孩的小火柴) 
    你的结果也不应该是null,而应该是”???“
      

  6.   

    这是一个完整函数,希望有用
    package leaveword;/**
     * Title:        leava
     * Description:       字符串转换
     * Copyright:    Copyright (c) 2003
     * Company:      202
     * @author lmt
     * @version 1.0
     */public class Getstr {  public Getstr() {
       }
      /**
       *将前台字符标准ISO8859_1转化为数据库字符标准GB2312
       *@param GB  返回的字符串
       */
      public String getGBstr(String Str){
                String GB=Str;
      try{    GB = new String(GB.getBytes("ISO8859_1"), "GBK");
        GB = new String(GB.getBytes("GBK"), "GB2312");
        }
          catch (Exception e)
                      {
                  System.out.println(e);
                      }
                      return GB;
        }
        /**
       *将数据库字符标准GB2312转化为前台字符标准ISO8859_1
       *@param  ISO  返回的字符串
       */
      public String getISOstr(String Str){
           String ISO=Str ;
      try{    ISO = new String(ISO.getBytes("GB2312"), "GBK");
        ISO = new String(ISO.getBytes("GBK"), "ISO8859_1");
        }
          catch (Exception e)
                      {
                  System.out.println(e);
                      }
                          return ISO;
        }  /**
       *将前台字符标准ISO8859_1转化为页面GBK
       *@param  GBK 返回的字符串
       */
       public String getGBK(String Str){
           String GBK=Str;
       try{
        GBK=new String(GBK.getBytes("ISO8859_1"), "GBK");
        }
          catch (Exception e)
                      {
                  System.out.println(e);
                      }
                          return GBK;
        }
    }
      

  7.   

    用get方法直接传中文一般都要出错。不出错的好象只有iis。所以你用get方法传中文不太合适
      

  8.   

    <%response.setContentType("text/html;charset=gb2312");
      request.setCharacterEncoding("gb2312");%>
      

  9.   


    在String isnull=request.getParameter("isnull");
    加一条语句试试:
      request.setCharacterEncoding("GBK");
      

  10.   

    回复人: zhuxr2003(zxr) ( ) 信誉:100  2003-05-17 11:12:00  得分:0 
     
     
      改web.xml的内码设置,如utf-8改为gb2312.
      
     
    请问,这位大哥指的内码设置我没找到,内码设置的格式是什么样的呢?
      

  11.   

    我也遇到了这样的问题,用get方式传中文的确有问题,我最后用的是session来传递要传的数据。还有一个方法就是使用request.setAttribute(),也许有用,也就是RequestDispatcher dp=getServletContext().getRequestDispatcher("/error/input_error.jsp");
    request.setAttribute("isnull","日期");
    dp.forward(request,response);
    然后再error.jsp中用request.getAttribute()来得到!
    试一试吧!
      

  12.   

    我感觉我的问题不是出在getParameter()上,因为用form传时,getParameter可以得到中文,没问题,就是在jsp:forward传时不行,或用“http://202.113.184.40/test/2.jsp?isnull=中文”也不行
      

  13.   

    对啊,用form的时候是post方式,用?isnull=中文和用forward时设置param都属于get方式,可以肯定的是用java的程序方式传递get方式的参数都存在这个问题, 我在jsp和servlet中用response.sendRedircet(url)时url中的中文也无法被浏览器识别,应该是j2ee这个平台等问题了吧!