aspose file tools*
The moose likes Servlets and the fly likes Logout servlet problem with back button 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 » Java » Servlets
Bookmark "Logout servlet problem with back button" Watch "Logout servlet problem with back button" New topic
Author

Logout servlet problem with back button

mallikarjun dontamsetti
Ranch Hand

Joined: Mar 18, 2011
Posts: 244

I am using logout and invalidating in servlet code is


but when i click the back button it is going to previously visited page..
Please help me...
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

First of all, implement the filter which looks for the active session whenever some one tries to access the user pages, in that case even if browser goes to last page after logout using back button, the user can't do anything as he/she will be redirected to login page.

To directly answer your question:
disable back button after logout

One clean Code note:
HttpSession ls = request.getSession(false);
'ls' doesn't sound good for session variable name, may be, umm, you can use more intrigued one, like "session"

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

Joined: Mar 18, 2011
Posts: 244

I am not supposed to use filter
pradeep gamage
Ranch Hand

Joined: Aug 03, 2009
Posts: 85


test with adding this also.
add some previous date to that date argument. if you can add listener you can solve this issue easily .


Software Engineer(BSC):SCJP 1.5
(Knowledge is power when applied)
mallikarjun dontamsetti
Ranch Hand

Joined: Mar 18, 2011
Posts: 244

Thanks it works but i added some java script to reload the page in body tag. it reload the page and solve my back button issue.
this is code


but it still displaying the previous user login name.please help me
pradeep gamage
Ranch Hand

Joined: Aug 03, 2009
Posts: 85

As I understand now your issue is when user logout in login page user name text feild display user name. if it problem you have to reset user name text feild when you redirect page.
if log out works fine. then you don't want reset login form feilds
 
jQuery in Action, 2nd edition
 
subject: Logout servlet problem with back button