如何能显示出中文? String name=request.getParameter("name");name=new String(getBytes("8859_1"));…………<%=name%> 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 sorry!!发晕了~~~~~~~~~name=new String(name.getBytes("8859_1")); String name= new String(request.getParameter("name").getBytes("ISO8859-1")); new String(name.getBytes("8859_1")); 加一句<%request.setCharacterEncoding("GB2312");%>传的参数最好是英文 <%@ page contentType="text/html; charset=gb2312" %>ywlx = new String(ywlx.getBytes("ISO8859_1"),"gb2312"); 参考:1)<%@ page contentType="text/html; charset=gb2312" %>是你的jsp页面中最上面的语句,修改charset即可;2)显示传递的中文参数:String passname = new String(request.getParameter("name").getBytes("ISO8859_1"), "gb2312");System.out.println(passname); 补充:上面第二句写在form中或form之前都行! String name= new String(request.getParameter("name").getBytes("ISO8859_1")); 怎么这么多人喜欢用转的方法,如果这种还出错,找我~~~~~~~~~~~<%@ page contentType="text/html; charset=gb2312" %><%request.setCharacterEncoding("gb2312");%>....<%=request.getParameter("name")%> jsp如何获得浏览器地址栏全路径 struts2项目启动时的问题 新入社区,前来报到 急呀!!!网页导出EXCEL(JSP) 请教如何使用htmlparser取的html表单中的值? 问大家一个WEB开发的专业术语,我很想知道啊!! window.showModalDialog在火狐下无法关闭 五百里加急呀!applet如何访问不在其所在服务器上的数据 关于applet的问题!紧急! tomcat检测javabean的修改日期? 如何将jsp页面查询出的数据转换成Excel表格!急!希望高手指点..... 为了理想放弃一切?!
发晕了~~~~~~~~~
name=new String(name.getBytes("8859_1"));
<%request.setCharacterEncoding("GB2312");%>传的参数最好是英文
1)<%@ page contentType="text/html; charset=gb2312" %>
是你的jsp页面中最上面的语句,修改charset即可;
2)显示传递的中文参数:
String passname = new String(request.getParameter("name").getBytes("ISO8859_1"), "gb2312");
System.out.println(passname);
上面第二句写在form中或form之前都行!
<%@ page contentType="text/html; charset=gb2312" %>
<%request.setCharacterEncoding("gb2312");%>
....
<%=request.getParameter("name")%>