This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Servlets and the fly likes Session Tracking Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Session Tracking" Watch "Session Tracking" New topic
Author

Session Tracking

Vishal Manchanda
Greenhorn

Joined: Aug 27, 2003
Posts: 1
How can we make the "Page Expired" option when user
> clicks on the Back button of the browser?(I am talking
> with respective Session tracking)
> I mean after coming to Logout page,instead of
> Logging out,if the user clicks on the Back button of
> the browser,it again opens returns main page without logging in.
I'm using JSP
session.invalidate is not working.
then i tried clearing the cache using
response.setHeader("Cache-Control","no-store");
response.setHeader("Pragma","no-cache");
response.setDateHeader ("Expires", 0);
but now the exact situation is
if I login I enter the main page and then logging off brings me back to login page.
Now pressing the browser back button it shows something like
"page has expired press refresh button"
pressing the refresh button a dialog asks retry or cancel
if I press retry It again opens the main page without logging in.

Can you tell me how it will be done..?
Praful Thakare
Ranch Hand

Joined: Feb 10, 2001
Posts: 627
Vishal,
Try this,if it helps u,
Keep the code of cache as it is and
add following lines at top of ur jsps.
if(session.getAttribute("userid")==null)
response.sendRedirect("login.jsp")
and add value to userid in session at login.
and invalidate session after logoff
regards
Praful
[ October 14, 2003: Message edited by: Praful Thakare ]

All desirable things in life are either illegal, banned, expensive or married to someone else !!!
 
Consider Paul's rocket mass heater.
 
subject: Session Tracking