1.

How to delete a session in servlet?

Answer»

When you are done with a user's session data, you have several options:

  • Remove a particular attribute: You can call public void removeAttribute(String name) method to delete the value associated with a particular key.

  • Delete the whole session: You can call public void invalidate() method to discard an entire session.Setting Session timeout: You can call public void setMaxInactiveInterval(int interval) method to set the timeout for a session individually.

  • Log the user out: The servers that support servlets 2.4, you can call logout to log the client out of the Web server and invalidate all sessions belonging to all the users.



Discussion

No Comment Found