This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes JSP and the fly likes how to kill a session Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "how to kill a session" Watch "how to kill a session" New topic
Author

how to kill a session

ali sookun
Greenhorn

Joined: Dec 26, 2008
Posts: 10
hi, i am performing a logout operation...when i clicked the logout link, the web site correctly direct me to the homepage...however when i press the back button it send me to the page where only a signedin user can access..
i used session.invalidate() to remove the session eventhough its not working...
i even try to disable the session in the homepage but in vain..
thnx in advance
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
Unless your code logic is really bad, that page is just displayed from the browser cache. If you want to prevent this, you'll have to add cache control headers to the HttpServletResponse so that the webbrowser is forced not to cache the page.

Don't forget to clear the browser's cache before testing it again.
ali sookun
Greenhorn

Joined: Dec 26, 2008
Posts: 10
hi again, i've been able to solve my problem...i included thes lines and it works
response.setHeader("Cache-control","no-store");
response.setHeader("Pragma","no-cache");
response.setDateHeader("Expires", -1);
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
You're welcome.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to kill a session
 
Similar Threads
logout issue
how to expire a session in struts without using cookies
Removing session
maintining two sessions in same browser window
request.getSession(false)