第一页<input name="name">文本框中输入中文处理那页
<%@ page contentType="text/html;charset=gb2312"%> //如果有这一行的话那name输出为??????,如果没有这一行的话那本页的中文又显示不了,是什么原因呢?各位请告诉小弟一下.
<%
String name=request.getParameter("name");
out.println(name);
out.println("中文");
%>

解决方案 »

  1.   

    <%
    request.setCharacterEncoding("GB2312");
    String name=request.getParameter("name");
    out.println(name);
    out.println("中文");
    %>
      

  2.   

    <%@ page contentType="text/html;charset=gbk"%> 
    试试
      

  3.   

    默认编码方式是不支持中文的.
    在加了<%@ page contentType="text/html;charset=gb2312"%> 这句话后通知浏览器,要进行gb2312转码
      

  4.   

    最通用的方法就是写一个过滤器就是了,写这个东西,在网上多的是,在Google上搜一下就行了,我这儿就写出来了!OK
      

  5.   

    <%@ page contentType="text/html;charset=gb2312"%>   这是网页显示的编码方式先看数据库的内容是不是中文,然后取时设置输出的编码方式
    request.setCharacterEncoding("GB2312");具体最好搜索一下,网上有的,应该很全。
      

  6.   

    request.setCharacterEncoding("GB2312");
      

  7.   

    request.setCharacterEncoding("GBK");
      

  8.   

    request.setCharacterEncoding("GBK");
    在tomcat下,在resin不用!
      

  9.   

    页面上加上这个
    <head>
    <meta http-equiv="content-Type" content="text/html;charset=gb2312">
    </head>
      

  10.   

    原来是两个页面
    把gb2312换换试试
    <%@ page contentType="text/html;charset=8859_1"%>
      

  11.   

    最好的方法是写一个FILTER这样可以把你整个目录里的编码都过滤成中文
      

  12.   

    jsp页面保存到数据库有乱码解决方法Jsp+tomcat+bean中文乱码问题解决方法javabean中参数有乱码
    1) 所有的jsp页面指定字符编码方式,如:Charest=gb2312,Charest=UTF-8等等
    2) 在应用服务器中的server.xml方件中找到设置服务器端口的行,一般是这样开头:”<Connector port="8080"”,
    3) 在找到的行"<Connector"开头的字符串后加上:URIEncoding="UTF-8" ,保存文件
    --------------------------------------------------------------------------
    jsp页面有乱码解决方法    所有的jsp页面指定字符编码方式,如:Charest=gb2312,Charest=UTF-8等等
        <%@ page contentType="text/html; charset=UTF-8">
    --------------------------------------------------------------------------
    jsp单个中文参数乱码解决方法    用这个转换一下: 
        <%!String trans(String chi)
           {
            string result =null;
            byte temp[];
            temp=chi.getBytes("iso=8859-1");
            result= new String(temp);
            }
        %>
    或者直接这样:
        <% 
          request.setCharacterEncoding("UTF-8");
          out.println(request.getParameter("参数ID")
        %>
    --------------------------------------------------------------------------
      

  13.   

    public String getstring(String s)
    {
    if(s==null){s="";}
    try
    {
    byte[] b=s.getBytes("ISO-8859-1");
    s=new String(b);
    }
    catch(Exception e)
    {
    s="";}
    return s;
    }加上这个方法就OK 了
      

  14.   

    <%@ page contentType="text/html; charset=UTF-8">
      

  15.   

    最好还是使用UTF-8吧.用GBK要是把位置换成中国香港的就乱码了,<%@ page contentType="text/html; charset=UTF-8">这句话好象只是让JSP服务器端使用你所要的CHARSET吧,要让浏览器用你指定的编码要在HEAD里加上
    <meta http-equiv="content-Type" content="text/html;charset=utf-8">不知道说的对不对.
      

  16.   

    request.setCharacterEncoding("GB2312");
    肯定ok了
      

  17.   

    不错,只要加一句request.setCharacterEncoding("GB2312");就行了。
    但要注意,这句必须写在request接收参数之前。否则没用!
      

  18.   

    我们可以先得到你要显示的汉字的字节流按下面的方法应该是可以的前边已经有人说过了解决了吗?
    public String getstring(String s)
    {
    if(s==null){s="";}
    try
    {
    byte[] b=s.getBytes("ISO-8859-1");
    s=new String(b);
    }
    catch(Exception e)
    {
    s="";}
    return s;
    }