给你一个JavaBean:
/**
 * Title:        含有中文的字符串转换成能正常显示中文的字符串
 *
 * Description:  --beans scope 推荐: "page"或"application"
 *
 **/public class tranChinese
  {
    public String toChinese(String s)
      {
        if (s != null)
         {
           try
            {
               return new String(s.getBytes("iso-8859-1"), "GB2312");
            }
          catch (java.io.UnsupportedEncodingException e)
{
  System.out.println(e.toString());
}
         }
        return s;
      }public String toUnicode(String s)
  {
    if (s != null)
     {
       try
        {
          return new String(s.getBytes("GB2312"), "iso-8859-1");
        }
       catch (java.io.UnsupportedEncodingException e)
{
   System.out.println(e.toString());
}
     }
    return s;
  }
}

解决方案 »

  1.   

    就在你取值的后面加.getByte("iso-8859-1")就可以了
      

  2.   

    在你的jsp页面中加如request.setCharacterEncoding("gb2312");语句,再用request.getParameter()提取参数。
      

  3.   

    加上这行代码
    <%@page contentType="text/html;charset=gb2312"%>
      

  4.   

    <%
    String str = new String(str1.getBytes("iso-8859-1");"gb2312");
    %>
      

  5.   

    楼上发言的同志,你们到底有没有试验过:http://locahost:8080/test/实验.jsp这种情况?哎,反正我只能通过使用jakarta-tomcat-4.1.24做服务器来解决这个问题