标题:这登录代码怎么有错呢
取消只看楼主
wolfcool
Rank: 1
等 级:新手上路
帖 子:102
专家分:0
注 册:2006-12-9
 问题点数:0 回复次数:0 
这登录代码怎么有错呢

<%@ page contentType="text/html;charset=gb2312"%>
<%@ page import="java.sql.*"%>
<jsp:useBean id="conn" scope="page" class="clj.DataBaseCon"/>
<%
String a =(String)request.getParameter("username");
String b =(String)request.getParameter("pass");
ResultSet rs=conn.mySelect("select * from account where username='"+a+"'and pass='"+b+"'");
if (!rs.next()){
out.print("<script>alert('用户名或密码错误!');history.back(-1);</script>");
}
else{
String sql="update account set sumlogin=sumlogin+1 where username='"+a+"'";
int rs1=conn.myUpdate(sql);
session.setAttribute("username",a);
out.print("<script>alert('欢迎光临!'); window.location='index1.jsp';</script>");

}

%>
判断记录集为空不能这样写吗,if (!rs.next())我看到有这样写的啊

org.apache.jasper.JasperException
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:372)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

root cause

java.lang.NullPointerException
    org.apache.jsp.logincg_jsp._jspService(logincg_jsp.java:60)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
搜索更多相关主题的帖子: 代码 登录 
2007-05-24 23:56



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-142313-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.197631 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved