aspose file tools*
The moose likes Struts and the fly likes Struts 2 - logout - prevent back button Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts 2 - logout - prevent back button" Watch "Struts 2 - logout - prevent back button" New topic
Author

Struts 2 - logout - prevent back button

francis varkey
Ranch Hand

Joined: Sep 13, 2005
Posts: 169
Hi,
In my struts2 application, I have a logout code. After logout I can't prevent browser back button. I am trying with following code

response.setHeader("Cache-Control","no-cache"); // HTTP 1.1
response.setHeader("Pragma","no-cache"); //HTTP 1.0
response.setDateHeader ("Expires", 0);

but its is not working.

Thanks
madhuri kunchala
Ranch Hand

Joined: Mar 30, 2010
Posts: 350
use response.setHeader("Cache-Control", "no-store");
debraj mallick
Ranch Hand

Joined: Mar 08, 2011
Posts: 188

i have tried the same but it didn't works, so i have use javascript to disable back button,
google and you will find a lots of javasript code to acheive the same.
Rajkamal Pillai
Ranch Hand

Joined: Mar 02, 2005
Posts: 443
    
    1

What happens if Javascript is disabled on the client side web browser?

This should be better handled by the application if setting the response header does not work. You would anyways be clearing session data associated with the logged in user in the logout Action. Check for that and handle appropriately.

Cheers,
Raj.
 
Don't get me started about those stupid light bulbs.
 
subject: Struts 2 - logout - prevent back button