<%@ page  contentType="text/html; charset=gb2312" import="java.sql.*" %>要放到页首!registor.jsp中显示的用户名是中文吗?如果不是将registor.htm该成jsp文件,文件头加上<%@ page  contentType="text/html; charset=gb2312">

解决方案 »

  1.   

    我试过了,但是没有变化。
    用request.getParameter()从registor.htm取得的值传到registor.jsp中时就已经是乱码了。
    到底应该则么办?
    将registor.htm该成jsp文件,文件头加上<%@ page  contentType="text/html;
    charset=gb2312">
    的方法也试过了,都不行!
      

  2.   

    要注意两点:
    1、
    <%@page contentType="text/html;charset=GB2312"%>2、所有从表单接收的参数都要按如下规格接收:
    String username=request.getParameter("username");
    username = new String( username.getBytes(), "GB2312" );String password=request.getParameter("password");
    password = new String( password.getBytes(), "GB2312" );..........
    当然你可以把
    new String( username.getBytes(), "GB2312" );
    做成一个函数去调用
      

  3.   

    通式:
    String str = new String(读出的str.getByte(),"GB2312");
      

  4.   

    在所有的jsp中加入
    <%
    request.setCharacterEncoding("GB2312");
    %>
      

  5.   

    果然好用,恩,挺强,谢谢,在联系,请你吃冰欺凌
    hitywt(^-^)