接受页上加<%request.setCharacterEncoding("gb2312");%>

解决方案 »

  1.   

    byte b[]=str.getBytes("ISO-8859-1");
    改为:
    byte b[]=str.getBytes("ISO8859_1");
      

  2.   

    接收页有了<%@ page contentType="text/html; charset=GB2312" %>还要<%request.setCharacterEncoding("gb2312");%>
    干嘛?
    我看很多书上都是这样写的byte b[]=str.getBytes("ISO-8859-1");
    请问它和byte b[]=str.getBytes("ISO8859_1");
    的区别是什么?
      

  3.   

    为什么要这么复杂呢?
    直接:
    <% out.println(str);%>
    就可以直接把接受的中文显示在网页上了.
      

  4.   

    我把它改成下面的
    <FONT COLOR = RED>
    <!--取得yourName控制项的传出值-->
    <% string str=request.getParameter("yourName");
       out.println(str);
    %></FONT>
    错现了这样的错误:type Exception reportmessage description The server encountered an internal error () that prevented it from fulfilling this request.exception org.apache.jasper.JasperException: Unable to compile class for JSPAn error occurred at line: -1 in the jsp file: nullGenerated servlet error:
        [javac] Since fork is true, ignoring compiler setting.
        [javac] Compiling 1 source file
        [javac] Since fork is true, ignoring compiler setting.
        [javac] E:\tomcat-5\work\Catalina\localhost\_\Response_jsp.java:59: cannot resolve symbol
        [javac] symbol  : class string 
        [javac] location: class org.apache.jsp.Response_jsp
        [javac]  string str=request.getParameter("yourName");
        [javac]  ^
        [javac] 1 error真是郁闷啊,请帮忙。
      

  5.   

    天哪!
    应该是String ,"S"要大写的嘛!