<%@ 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)