前面加上<%@ page contentType="text/html; charset=GB2312"%>

解决方案 »

  1.   

    web服务器是什么?什么版本
    <%@ page contentType="text/html; charset=GBK"%>
      

  2.   

    这是表单间传递参数的乱码问题,给你看一下这个二、表单提交中文时出现乱码 
    下面是一个提交页面(submit.jsp),代码如下: 
    <html> 
    <head> 
    <title>JSP的中文处理</title> 
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> 
    </head> <body> 
    <form name="form1" method="post" action="process.jsp"> 
    <div align="center"> 
    <input type="text" name="name"> 
    <input type="submit" name="Submit" value="Submit"> 
    </div> 
    </form> 
    </body> 
    </html> 
    下面是处理页面(process.jsp)代码: 
    <%@ page contentType="text/html; charset=gb2312"%> 
    <html> 
    <head> 
    <title>JSP的中文处理</title> 
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> 
    </head> <body> 
    <%=request.getParameter("name")%> 
    </body> 
    </html> 
    如果submit.jsp提交英文字符能正确显示,如果提交中文时就会出现乱码。原因:浏览器默认使用UTF-8编码方式来发送请求,而UTF-8和GB2312编码方式表示字符时不一样,这样就出现了不能识别字符。解决办法:通过request.seCharacterEncoding("gb2312")对请求进行统一编码,就实现了中文的正常显示。修改后的process.jsp代码如下: 
    <%@ page contentType="text/html; charset=gb2312"%> 
    <% 
    request.seCharacterEncoding("gb2312"); 
    %> 
    <html> 
    <head> 
    <title>JSP的中文处理</title> 
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> 
    </head> <body> 
    <%=request.getParameter("name")%> 
    </body> 
    </html>
      

  3.   

    我在我的电脑上试了,没有问题,可以正常运行,也没有显示乱码,我用的是Tomcat4.1.不过有点建议,form.html最好改成这样:
    <html>
         <head>
              <title>理解JSP的原理</title>
         </head>
         <body>
              <p>请输入显示的次数:</p>
              <form method=get action="helloworld.jsp">
              <input type="text" name="times">
              <input type="submit" value="提交">
              </form>
         </body>
    </html>注:<input type="text" name="times">
              <input type="submit" value="提交">
    这两句中你缺少引号
      

  4.   

    fengfengjunjun的方法好像不行耶
      

  5.   

    victorylj谢谢你,我就不懂我的为什么出现乱码!其它的都是
      

  6.   

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

  7.   

    页面头加上
    <%@ page contentType="text/html; charset=GBK"%>要么就是对汉字编码-