Friday, 10 March 2017

J2EE: How to remove contents of Http Session

You can remove contents of a HttpSession by calling removeAttribute() method. for example

request.getSession().removeAttribute("cart"); -- removes item cart from HttpSession

1 more way is to call getAttribute() and then calling the clear() on map.

request.getSession().getAttribute("cart").clear();

0 comments:

Post a Comment

Note: only a member of this blog may post a comment.