• Post Reply Bookmark Topic Watch Topic
  • New Topic

After Logout still keeping session

 
Simpson Kumar
Ranch Hand
Posts: 261
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
After I logged out , the controller goes to home page in that I removed the user in the session and finally invalidate the session.
When after I go back to previous page and hit any operation, it's still working. I don't know why the session is still keeping.

Here is the code I followed..

Logout servlet:In the home page, I'm setting no cache, etc..What's wrong with my code and why its still keeping the session?
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


A likely explanation is that this if test fails and the invalidate() is never called.

There is no reason to check for anything except session != null before invalidating.

Bill
 
Mohamed Inayath
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sudhakar Kumar wrote:When after I go back to previous page and hit any operation, it's still working. I don't know why the session is still keeping.


With your comment its understood that you are invalidating the session.
When you say , you selected previous page, did you selected Browser back?

If this is the case its Browser cache which is getting displayed.

How you are saying that session is still keeping?
 
Simpson Kumar
Ranch Hand
Posts: 261
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Mohamed Inayath wrote:
If this is the case its Browser cache which is getting displayed.

How you are saying that session is still keeping?


But in all pages I maintian No cache, then no point to maintain the cache.. See the following code for cache


 
Mohamed Inayath
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When you select browser back then there will be a GET request invoked to the orgin server with the URL used previusuly.
If you have a workflow in place then you get everything right or the previous page will not be displayed.
 
Nishan Patel
Ranch Hand
Posts: 689
Eclipse IDE Java Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

hi,

I think that would not happen.

When you click back and perform operation which required login or session and if you remove session for application then it's always redirect login page...


 
Mohamed Inayath
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nishan Patel wrote:
hi,

I think that would not happen.

When you click back and perform operation which required login or session and if you remove session for application then it's always redirect login page...




Yes you are right when any operation is done on the previous page when already session is invalidated.

But if you see the below comment; Sudhakar Kumar wants to know why when browser back is selected he is able to see the previous screen.
If he has set not to cache.
But in all pages I maintian No cache, then no point to maintain the cache..


So When user selects browser back there is GET request to the server.
 
karan khosla
Greenhorn
Posts: 25
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When invalidate() method is invoked the session object you are working on gets destroyed immediately. But when you click the back button and refresh the page or fire any operation from there a new session object gets created and start maintaining your session from that time onwards. I hope this information is useful for you.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!