Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

end jsp session  RSS feed

 
Hari priya
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi -

Thank you all guys for you continuous support and helping people.

I have another question. I was trying to end the current session by calling invalidate() which doesn't seem to quite work. When I press the browsers back button, I am still able to perform all the funtions of the user who has logged in.

Any idea why this is happening?
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Because everything is cached. This is a common problem which is tricky to resolve because different browsers handle caching in different ways. You might want to check out this thread in the Servlets forum where they have been discussing a very similar issue.
 
Hari priya
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi -

I was trying not to allow caching by using -

response.setHeader("Cache-Control","no-cache");

but still it doesn't seem to work. The login information still seemed to be cached and the user is able to perform all teh actions after hitting the logout button.

I can get back all the information by refreshing the page.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66142
141
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you sure that the session is being invalidated?

Are you sure that the site has no logic that automatically logs users in from cookie data or elsewhere?

Are you sure that your actions actually check that a user is logged in before performing their processing?
 
Hari priya
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I finally got it to work. Thank you for responding to my problem.
 
Rishi Kishoreshah
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am having the same problem and want to flush out the session variables on log out. Could you tell me how to end the session.? I jus' write
<%=session.invalidate()%>
in the logout.jsp file. I wonder if that is enough to terminate all session variables.

Rishi.
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch, Rishi Kishoreshah!

According to the documentation for javax.servlet.http.HttpSession in the the J2EE 1.4 API Specification, the invalidate method "[i]nvalidates this session then unbinds any objects bound to it."
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!