M Sach
M Sach

Reputation: 34424

Should we reset the session variables to null on web application logout?

Httpsession is per browser.Ideally should we reset the session variables on logout otherwise it will always be available for that Browser even user login again.Is that correct?

Upvotes: 1

Views: 3742

Answers (2)

Pablo Santa Cruz
Pablo Santa Cruz

Reputation: 181340

You don't need to reset all session variables. You just need to call session.invalidate() and servlet framework will take care of the rest.

Upvotes: 0

adarshr
adarshr

Reputation: 62593

You can just invalidate the session by calling HttpSession.invalidate() which will clear all the attributes as well as destroy the session itself.

Upvotes: 3

Related Questions