Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JSF button to reset the session

Is there a way to reset (clear) the session for a user, when he clicks on a button?

like image 636
Stella Peristeraki Avatar asked Mar 01 '23 06:03

Stella Peristeraki


1 Answers

What about

session.invalidate(); 

invalidate method of session object is used to discard the session and releases any objects stored as attributes. This method helps to reduce memory overhead and achieves improvement in performance. It is always a good practice to explicitly remove or invalidate sessions using session.invalidate() method.

or

session.removeAttribute(String) 

The removeAttribute method of session object is used to remove the attribute and value from the session.

like image 98
rahul Avatar answered Mar 08 '23 02:03

rahul