try:String sStr = (String)request.getAttribute("what") ;
sStr = new String(sStr.getBytes("8859_1"),"gb2312");

解决方案 »

  1.   

    jsp中加入下面两条再用楼上的
    <%@ page  language="java" contentType="text/html;charset=gb2312"
     %>
    <meta http-equiv="content-type" content="text/html; charset=gb2312">
      

  2.   

    <%@ page  contentType="text/html;charset=gb2312"%>
    <%String str=(String)request.getAttribute("what");%>function init()
      {
        document.frmEntrustAdd.Trust_Id.value=<%=new String(str.getBytes("8859_1"),"gb2312")%>;
        frm = document.forms("frmEntrustAdd");
        toolbar = top.frames["toolbar"].mainToolbar;
        toolbar.init();
        toolbar.attachProcess("提交", SumitProcess);
        toolbar.attachProcess("取消", CancelProcess);
        toolbar.show("提交","取消");    }然后,调用了init(),可是总是说什么缺少对象,
    这里是有Trust_Id的呀
      

  3.   

    document.frmEntrustAdd.Trust_Id.value=<%=new String(str.getBytes("8859_1"),"gb2312")%>;
    改为:
    document.frmEntrustAdd.Trust_Id.value="<%=new String(str.getBytes("8859_1"),"gb2312")%>";
      

  4.   

    document.frmEntrustAdd.Trust_Id.value=<%=new String(str.getBytes("8859_1"),"gb2312")%>;
    改为:
    document.frmEntrustAdd.Trust_Id.value="<%=new String(str.getBytes("8859_1"),"gb2312")%>";
      

  5.   

    document.frmEntrustAdd.Trust_Id.value="<%=str%>";
    这样就好用了,不过还是谢谢各位老大,原来只是缺少2个引号
      

  6.   

    <%
    String str=(String)request.getAttribute("what");
    System.out.println(str);
    %>
    打出来看看是什么东西!
    <%
    System.out.println(new String(str.getBytes("8859_1"),"gb2312");
    %>
    看看是什么东西!
    把结果告诉我!