When to remove session attribute when a session last thru several servlets
843835Apr 13 2003 — edited Apr 13 2003Hello there,
The whole scenario is described as following:
First a user logged in to a website, as usual he comes to the main page.
The main page has several links , each of which links to different servlet (application). That means during a user's session, he will interact with several servlets(applications). Now I am writing one of these applications, which will have several jsp pages, I want to share some parameters between those pages, then session is a good place
to store them. But these parameters are only to be used in my application, after the user goes back to the home page clicking to the other application, he won't need those information any more.
But now I can not come up a good idea when to remove those attributes from session. Cause if I put "session.removeAttribute()" in jsp page, you don't know if user will visit the same page again. Maybe I should put some logic in the "home" link, when he wants to go back to homepage, that means he wants to leave my application for a while, then I can delete the session attribute I put during my application.
Did anyone meet the same problem before ?
Thanks,
Rachel