In below snippet, the else
is always invoked. The if
is never entered, even though the while
block is successfully entered.
while (rs.next()) {
username = rs.getString(2);
password = rs.getString(3);
}
if(rs.next())
{
response.sendRedirect("Welcome.jsp");
}
else {
response.sendRedirect("Fail.jsp");
}
How is this caused and how can I solve it?