请教从SERVLET传递参数到JSP中的中文问题。 try:String sStr = (String)request.getAttribute("what") ;sStr = new String(sStr.getBytes("8859_1"),"gb2312"); 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 jsp中加入下面两条再用楼上的<%@ page language="java" contentType="text/html;charset=gb2312" %><meta http-equiv="content-type" content="text/html; charset=gb2312"> <%@ 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的呀 document.frmEntrustAdd.Trust_Id.value=<%=new String(str.getBytes("8859_1"),"gb2312")%>;改为:document.frmEntrustAdd.Trust_Id.value="<%=new String(str.getBytes("8859_1"),"gb2312")%>"; document.frmEntrustAdd.Trust_Id.value=<%=new String(str.getBytes("8859_1"),"gb2312")%>;改为:document.frmEntrustAdd.Trust_Id.value="<%=new String(str.getBytes("8859_1"),"gb2312")%>"; document.frmEntrustAdd.Trust_Id.value="<%=str%>";这样就好用了,不过还是谢谢各位老大,原来只是缺少2个引号 <%String str=(String)request.getAttribute("what");System.out.println(str);%>打出来看看是什么东西!<%System.out.println(new String(str.getBytes("8859_1"),"gb2312");%>看看是什么东西!把结果告诉我! 系统操作日志的记录? 获得select multiple option 中的值 myeclipse5.5的一个配置。。。 java 常量类中的常量值修改后不起作用 请问 javaMail中要设置用户的权限 要怎么写 问一个Hibernate中的Trsaction的问题 Hibernate问题 怎么在oracle中插入长字符串 文件上传的问题?帮忙调试一下。thanks! 为什么string不能转换? 如何在jsp页面中实现列表框?需要动态添加列表框的内容 tomcat 下使用 .shtml 文件,<servlet> 标签直接作为代码输出了,什么问题??
<%@ page language="java" contentType="text/html;charset=gb2312"
%>
<meta http-equiv="content-type" content="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的呀
改为:
document.frmEntrustAdd.Trust_Id.value="<%=new String(str.getBytes("8859_1"),"gb2312")%>";
改为:
document.frmEntrustAdd.Trust_Id.value="<%=new String(str.getBytes("8859_1"),"gb2312")%>";
这样就好用了,不过还是谢谢各位老大,原来只是缺少2个引号
String str=(String)request.getAttribute("what");
System.out.println(str);
%>
打出来看看是什么东西!
<%
System.out.println(new String(str.getBytes("8859_1"),"gb2312");
%>
看看是什么东西!
把结果告诉我!