File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes Session problem plz Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Reply locked New topic

Session problem plz

s. anitha

Joined: Jan 18, 2005
Posts: 18
after pressing logout i invalidated the session.then i press the

back i show that the page has expired.

using this code:

<% response.setHeader("Pragma","no-cache");%>
<% response.setHeader("Cache-Control","no-store");%>
<% response.setDateHeader("Expires",-1);%>

the expired page is showing using this code

my problem is if i press refresh or f5,it

is showing the pages .how to avoid these.plz help me.
David O'Meara

Joined: Mar 06, 2001
Posts: 13459

Are you sure your logout is working? Try adding some logging so you can see if the second request (when you hit F5) is causing the code to execute. The only way you can get the page to be shown again is if the browser requests the page and the server returns the page, so you should make sure you're not returning the page.
David O'Meara

Joined: Mar 06, 2001
Posts: 13459

That's a nice piece of 'no cache' code, but are you sure you send it with every page sent to the user while they are logged in? It's not good enough to send it after the fact, useless even.
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63858

Anitha, please do not post the same question more than once.

Forum bartender
[ January 18, 2005: Message edited by: Bear Bibeault ]

[Asking smart questions] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: Session problem plz
It's not a secret anymore!