phoebeching
03-22-2007, 07:48 PM
Hi, Good day,
I had the following code where I can't figure out how should I write. The situation is when a user login, if their ID was not found in the database, it will redirect them back to login page, else redirect them to homepage.
while (result.next()) {
if (result.wasNull()) {
response.sendRedirect("login.jsp");
}
else {
response.sendRedirect("home.jsp");
}
}
If I place the "response.sendRedirect("home.jsp");" outside the while loop, I will get this following error "java.lang.IllegalStateException".
Pls help. Thanks in advanced.
I had the following code where I can't figure out how should I write. The situation is when a user login, if their ID was not found in the database, it will redirect them back to login page, else redirect them to homepage.
while (result.next()) {
if (result.wasNull()) {
response.sendRedirect("login.jsp");
}
else {
response.sendRedirect("home.jsp");
}
}
If I place the "response.sendRedirect("home.jsp");" outside the while loop, I will get this following error "java.lang.IllegalStateException".
Pls help. Thanks in advanced.