if rs.next

if rs.next

题目
if rs.next
org.apache.jasper.JasperException:An exception occurred processing JSP page /admin/Acheck.jsp at line 16
13:
14:String sql="select * from cqut_admin where Id=+login+ and Password=+password+";
15:ResultSet rs=con.executeQuery(sql);
16:if(rs.next()){
17:session.setAttribute("login",login);
18:response.sendRedirect("index.htm");
19:}else{
Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:515)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:426)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
root cause
java.lang.NullPointerException
org.apache.jsp.admin.Acheck_jsp._jspService(Acheck_jsp.java:70)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.htt
答案
是不是需要用con创建个Statement或PreparedStatement对象,再用这个对象执行executeQuery? Statement stat = con.createStatement(); ResultSet rs = stat.executeQuery(sql); 记得即使没取到数据rs也不是...
举一反三
已知函数f(x)=x,g(x)=alnx,a∈R.若曲线y=f(x)与曲线y=g(x)相交,且在交点处有相同的切线,求a的值和该切线方程.
我想写一篇关于奥巴马的演讲的文章,写哪一篇好呢?为什么好
奥巴马演讲不用看稿子.为什么中国领导演讲要看?
想找英语初三上学期的首字母填空练习……
英语翻译
最新试题
热门考点

超级试练试题库

© 2017-2019 超级试练试题库,All Rights Reserved.