JSP乱码问题 String typename=request.getParameter("typename");是乱码吗?浏览器传过来的不可能是iso8859_1的(iso8859_1显示不了中文的)。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 你是用Servlet?typename="中文" 的样式提交的吗? String typename=new String(request.getParameter("typename").getBytes("ISO-8859-1"),"GBK")不是iso8859_1 痛苦呀,还不能解决,我是用一个网址传参数到另一个JSP页面的,如list.jsp?type=<%=type%>但到了list.jsp的页面哪个type如果是中文就乱码了以下是list.jsp<%@page import="net.ijsp.news.news.*,net.ijsp.news.util.*,java.util.*,java.sql.*,pub.*"%><%//@page errorPage="error.jsp"%><head><title></title><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><META HTTP-EQUIV="imagetoolbar" CONTENT="no"><link href="../default.css" rel="stylesheet" type="text/css"></head><%//String cBytes="GBK";//request.setCharacterEncoding(cBytes);int id=ParamUtils.getInt(request,"id",0);String type=new String(request.getParameter("type").getBytes("ISO-8859-1"),"gb2312");out.println(type);//出来的type是乱码%> http://community.csdn.net/Expert/topic/4165/4165322.xml?temp=.4852106楼主去看看这片文章,那里面有我写的一个方法,能解决你的问题 <%@ page contentType="text/html; charset=gb2312" %>加这个,然后把getBytes("ISO-8859-1"),"gb2312")去掉,就OK了 菜鸟提问 application session request cookie 生命周期 IE6显示的下拉菜单的问题 看看我的程序,打开word乱码 怎么调用BEAN返回对象的get方法? jeecms中的注册问题??? 提问:我的有JSP代码的网页显示不正确,怎么回事?总是一个大空白,好像图片无法显示那样。 高分求救JSP和MYSQL的连接问题!! 新手问题 登录安全问题 jsp怎样完成下面功能? 送分了,大家来来看看! 哪位高人作个大型网站的后台管理程序?
但到了list.jsp的页面哪个type如果是中文就乱码了
以下是list.jsp
<%@page import="net.ijsp.news.news.*,net.ijsp.news.util.*,java.util.*,java.sql.*,pub.*"%>
<%//@page errorPage="error.jsp"%><head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<META HTTP-EQUIV="imagetoolbar" CONTENT="no">
<link href="../default.css" rel="stylesheet" type="text/css">
</head>
<%
//String cBytes="GBK";
//request.setCharacterEncoding(cBytes);
int id=ParamUtils.getInt(request,"id",0);
String type=new String(request.getParameter("type").getBytes("ISO-8859-1"),"gb2312");
out.println(type);//出来的type是乱码
%>
楼主去看看这片文章,那里面有我写的一个方法,能解决你的问题
加这个,然后把getBytes("ISO-8859-1"),"gb2312")去掉,就OK了