应该是编码问题吧?呵呵第一次做网页,请多多指教阿

解决方案 »

  1.   

    在page指令中加上contentType = "text/html; charset=GBK"
    如下:<%@ page contentType = "text/html; charset=GBK"%>
      

  2.   

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

  3.   

    下面是我的代码,不行
    <%@ page contentType="text/html; charset=GB2312" %>
    <jsp:useBean id="data" class="com.bwm.db.Data" scope="page"/>
    <jsp:useBean id="show" class="com.bwm.page.Show" scope="page"/>
    <html>
    <head>
    <title>
    login
    </title>
    </head>
    <body>
    <%
    String strUserName = new String(request.getParameter("username").getBytes("GBK"),"ISO8859-1");
    String strPassword = new String(request.getParameter("password").getBytes("GBK"),"ISO8859-1");
    String strSelect   = new String(request.getParameter("select").getBytes("GBK"),"ISO8859-1");
    int intT=0;
    if(strSelect!=null&&strSelect.equals("user")){
            intT=data.getRowCount("po_staff WHERE sname='"+strUserName+"' AND password='"+strPassword+"'");
            if(intT>0){
                session.setAttribute("name",strUserName);
                    session.setAttribute("use","user");
                response.sendRedirect("oa/index.jsp");
            }else{
                    out.print(show.errorBox("检查你的用户名或密码!","验证错误"));
                    return;
            }
    }else if(strSelect!=null&&strSelect.equals("admin")){
            intT=data.getRowCount("po_admin WHERE admin='"+strUserName+"' AND password='"+strPassword+"'");
            if(intT>0){
                session.setAttribute("admin",strUserName);
                    session.setAttribute("use","admin");
                response.sendRedirect("admin/admin.jsp");
            }else{
                out.print(show.errorBox("检查你的用户名或密码!","验证错误"));
                return;
            }
    }else{
            out.print(show.errorBox("检查你的用户名或密码!","验证错误"));
            return;
    }
    %>
    </body>
    </html>
      

  4.   

    将数据库里的数据类型用 nvarchar、 ntext等,试试
      

  5.   

    String strUserName = new String(request.getParameter("username").getBytes("GBK"),"ISO8859-1");
    String strPassword = new String(request.getParameter("password").getBytes("GBK"),"ISO8859-1");
    String strSelect   = new String(request.getParameter("select").getBytes("GBK"),"ISO8859-1");
    这几句单纯写为String strUserName = request.getParameter("username");也不行
      

  6.   

    实在不行,用filter..应该知道的
      

  7.   

    1.String strUserName = new String(request.getParameter("username").getBytes("ISO8859-1"),"GBK");2.String strUserName = new String(request.getParameter("username").getBytes("ISO8859-1"));3.request.SetcharacterEncoding("gb2312");
      

  8.   

    晕,原来掉转了,这个句子是把“gbk"转换为“ISO8859-1”吧,那么数据库的编码是ISO8859-1吗?
      

  9.   

    问题解决,thx to wsk_228(qing_feng)