Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

session.invalidate doubt

 
adeeb alexander
Ranch Hand
Posts: 268
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi.
I would like to know why the session.invalidate() doent kill the session completely.

If user click the refresh button he can view the logged out pages also, i.e duplicate form submission.

From where the browser is getting back the data???

where that data is stored??

the data which i am telling is the forwarded data from jsp to servlet, at least the jsp fields data should be destroyed, is there any way to do that??

Thanks and Regards
Adeeb.
 
Sumit Bisht
Ranch Hand
Posts: 331
Python Ruby Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
session.invalidate() clears the server side session.
For the client side (browser) session, you will need to make sure the window gets closed (manually/javascript)
you can solve the problem of duplicate submission by using session objects as tokens that are validated on that event.
Your browser stores its data (fields, etc) in form of cookies and autoloads the session information. Try clearing your cache/ form autoload information to solve that.
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi adeeb,

you are asking many question in a single post. and really they are *not* clear to me too.

also Please, UseOneThreadPerQuestion
 
adeeb alexander
Ranch Hand
Posts: 268
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your replies.

In simple words, when i click signout, it is forwarded to logoutservlet, there i have invalidate the session. now when i click back button of browser I get the document expired. That is ok. When i refresh sgain, the page loads. I have gone through the PRG patter, i am unable to implement it, as i am not using any framework. I dint get into my head and trying this since yesterday. . So i was saying that after the page is refreshed i could still see the old data, how come when the session is invalidated? Means this method invalidate is fooling us around?? Some one guide me to a easire way, only one problem and these many



Thanks
 
Prasad Krishnegowda
Ranch Hand
Posts: 671
4
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
session.invalidate will clear the data, Its not fooling us. If the browser is showing the page, even after session.invalidate, its most likely to be a browser cache..
 
adeeb alexander
Ranch Hand
Posts: 268
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there any way to clear taht cache using servlet. Is it possible???
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We have a FAQ entry in JspFaq . NoCacheHeaders . also similar topics discussed many times here. Please Search here for more detail.
 
Prasad Krishnegowda
Ranch Hand
Posts: 671
4
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
check NoCacheHeaders in the servlets FAQ section here..
 
adeeb alexander
Ranch Hand
Posts: 268
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for quick reply.

But i already added this still the page loads when refreshed..

 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
adeeb alexander wrote:
But i already added this still the page loads when refreshed..



Hope you have added them in Jsp. well now did you check the valid session there ? if invalid then did you redirect to login page or some where else?
 
adeeb alexander
Ranch Hand
Posts: 268
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have tried as you said. Check the below code. Is that what you were saying to do, to check the session?? It dint help, any other way out??


IN JSP





SERVLET



Thanks.
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
adeeb alexander wrote: Is that what you were saying to do, to check the session??

ohh. noo... I think first you need to thoroughly understand the scope objects in servlet. by the way : you have any idea about javax.servlet.Filter?

<edit>corrected typo</edit>
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic