Invalidating session in jsp onlinedating website

You can call invalidate to discard an entire session.

Just remember that doing so causes all of that user’s session data to be lost, not just the session data that your servlet or JSP page created.

Invalidate the session in the servlet or the JSP that you go to when a user hits "log out".

But I am not sure, if this deletes some necessary session-attributes like login-data. Edit: The best solution would be, each time you open a certain page you create a new session for that window/tab until you close the tab or revisit that page in this tab.

This question occurred by the attempt to solve this problem.

When a user hits the log out button it directs them to that page, which in turn checks for an active session and if it finds one, calls session.invalidate() then redirects the user back to the home page (or wherever you would like).

Take a look at this thread, it has some answers that you are looking for. t=146975 I use a servlet for the sole purpose of log outs.

Search for invalidating session in jsp:

invalidating session in jsp-46invalidating session in jsp-24invalidating session in jsp-89

Leave a Reply

Your email address will not be published. Required fields are marked *

One thought on “invalidating session in jsp”