• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Logout servlet problem with back button

 
mallikarjun dontamsetti
Ranch Hand
Posts: 246
Firefox Browser Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2906
1
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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"
 
mallikarjun dontamsetti
Ranch Hand
Posts: 246
Firefox Browser Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not supposed to use filter
 
pradeep gamage
Ranch Hand
Posts: 85
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

test with adding this also.
add some previous date to that date argument. if you can add listener you can solve this issue easily .
 
mallikarjun dontamsetti
Ranch Hand
Posts: 246
Firefox Browser Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 85
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic