String typename=request.getParameter("typename");
是乱码吗?
浏览器传过来的不可能是iso8859_1的(iso8859_1显示不了中文的)。

解决方案 »

  1.   

    你是用Servlet?typename="中文" 的样式提交的吗?
      

  2.   

    String typename=new String(request.getParameter("typename").getBytes("ISO-8859-1"),"GBK")不是iso8859_1
      

  3.   

    痛苦呀,还不能解决,我是用一个网址传参数到另一个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是乱码
    %>
      

  4.   

    http://community.csdn.net/Expert/topic/4165/4165322.xml?temp=.4852106
    楼主去看看这片文章,那里面有我写的一个方法,能解决你的问题
      

  5.   

    <%@ page contentType="text/html; charset=gb2312" %>
    加这个,然后把getBytes("ISO-8859-1"),"gb2312")去掉,就OK了