以下代码给我一个很头痛的问题。为什么我的if
忽略rs.next() == true
?java jsp if语句
System.out.println(rs.next());
if (rs.next() == true) {
System.out.println("1");
session.setAttribute("userid", userid);
//out.println("welcome " + userid);
//out.println("<a href='logout.jsp'>Log out</a>");
response.sendRedirect("success.jsp");
} else {
System.out.println("2");
out.println("Invalid password <a href='index.jsp'>try again</a>");
}
控制台:
#1 SELECT * FROM users where username = 'test' and password = 'test'
#2 true
#3 2
我在做什么在这里错了吗?
* facepalm *谢谢,作品! – piguy