In the beginning of a JSP page, I checked for a variable called "sessionLogin" everytime a user click a submit button in a form. And if this variable is empty or NULL then I redirect to another page called "invalidLogin.jsp".
I have checked and the redirection is working ok. But the second if statement below keeps getting executed even though the page is redirected. I don't know why. Could someone please advise? I'm probably missing something trivial here.
The sendRedirect method does not halt the execution of your method. You should either branch your code in such a way that the call to sendRedirect is the last statement in your method or explicitly call return; after calling sendRedirect.