aspose file tools*
The moose likes Struts and the fly likes how to avoid browser back button after logout Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "how to avoid browser back button after logout" Watch "how to avoid browser back button after logout" New topic
Author

how to avoid browser back button after logout

zimbu bolleddu
Ranch Hand

Joined: Jan 14, 2008
Posts: 35
Hi all,

How to restrict or avoid browser back button after logout.
I have performed :
1) session.invalidate()
2) delete cookies.
But whenever I clicked on back button it shows previous page.

Please anybody help me out. Code examples are highly appreciated.

Thanks in advance
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

If you are checking the session , for each request thru action class, then by chance the user clicks on back button and got the previous page, he cant do anything, because session has been expired and he cant perform any activity, he need to login again !!


[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
zimbu bolleddu
Ranch Hand

Joined: Jan 14, 2008
Posts: 35
Thanks for your reply.

Yeah he can't do anything but I don't want allow him to click on back button,
If he/she clicked on back button it should display session expired or any specified error message.

Thank you ..
Rishi Varma
Greenhorn

Joined: Jul 06, 2008
Posts: 9
Well, the samething applies.
You need check the session in each action class; if the session is invalid; throw an exception and catch.

and simply forward to the corresponding error page from the catch block.
Hope you get this.
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

have you googled it ?
[ July 09, 2008: Message edited by: Sagar Rohankar ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to avoid browser back button after logout