How can the Session in Servlet be destroyed?

How can the Session in Servlet be destroyed?

Ninja Asked on 19th September 2018 in Servlet.
Add Comment
1 Answer(s)
Best answer

An existing session can be destroyed in the following ways:

  • Programmatically : Using session.invalidate() method, which makes the container abandon the session on which the method is called.
  • When the server itself is shutdown.
  • Setting timeout in the deployment descriptor: This can be done by specifying timeout between the <session-timeout>tags.
  • Setting timeout programmatically: This will set the timeout for a specific session.
Ninja Answered on 19th September 2018.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.