servlet request + javax Filters: how do I redirect users to another page?
might be best explain with an example:
- I have a servlet that returns true or false if HTTP post is successful.
- I also have a javax filter that checks if a user still has a session. if no session, redirect the user to the login page.
- User has 2 browser tabs open and both of them are displaying a form (could be the same or different forms).
- in tab1, user logs out.
- in tab2, user decides to submit the form (which is calling an servlet).
- In my filter and when processing the request for tab2, I w ant to redirect the user to the login page since they already logged out in tab1.
How can I do this? I have tried response.sendRedirect and request.getRequestDispatcher. Both of them does not redirect the user to another page.
Thanks