aspose file tools*
The moose likes JSP and the fly likes Logging out problem in JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Logging out problem in JSP" Watch "Logging out problem in JSP" New topic
Author

Logging out problem in JSP

seema mani
Ranch Hand

Joined: Sep 30, 2001
Posts: 49
I'm using session.invalidate to logout from the session. After that I'm redirecting the user to the login page again. The problem I'm facing is that if the user clicks the back button of the browser, he's able to see the previous page details again. How do I prevent this ? If the user clicks back button after logging out he should get the message 'You are not logged in'.
How do I achieve this ?
PLease help.
Thanks
Seema


Sun Certified Java Programmer<br />Sun Certified Web Component Developer<br />Sun Certified Business Component Developer
Po-yu Chien
Ranch Hand

Joined: Nov 01, 2001
Posts: 45
I don`t know how actually solve your problem,
however this problem should be related with browser`s cache mechanism. There should be some <meta .../> tag to disable both browser`s cache and proxy`s cache. This should be the direction toward solving the problem. Good luck!
Sals Hamid
Greenhorn

Joined: Jan 04, 2002
Posts: 24
By using if condition u can do this e.g.
if(session.getValue("usr")==null)
<jsp:forward page ="login.html"/>


No Path of Flowers lead to glory
Biju Nair
Ranch Hand

Joined: Dec 15, 2001
Posts: 31
Checking for the session value on the server side may not help as when u press the browser's back button, the page is displayed from the browser's cache. One way to prevent this is to avoid caching of the page by the browser as well as any proxy servers (if any).
Try this code in all your jsp pages which you don't want to be cached
<%
response.setHeader("Cache-Control","no-cache");
response.setDateHeader("Expires","0");
response.setHeader("Pragma","No-cache");
%>
For more information about tag-libs to prevent caching, go to http://javaboutique.internet.com/resources/books/JSP_SiteDesign/design1_3.html
[ January 27, 2002: Message edited by: Biju Nair ]

--: Biju Nair :--
seema mani
Ranch Hand

Joined: Sep 30, 2001
Posts: 49
Thanks Biju
That worked just fine.
By the way, just wanted to mention that I'm also from TVPM,Kerala.
Thanks a lot.
Seema
Arun Boraiah
Ranch Hand

Joined: Nov 28, 2001
Posts: 233
hi
plz use this space for technical query rather then personal touch. You can make use of email faculty for the same.
Don't mistake. Let's make friends with all, rather then region specific.
-arun


Sharing is learning
Doshi Milan
Ranch Hand

Joined: May 29, 2001
Posts: 112
Hello friends,
I am working on a huge project which have n number of JSPs and Servlets (going well over hundreds ). In our maintainance work we ahave been told about the similar probelem. i.e when the user logs out he should not be able to view his earlier pages using the browser Back button.
I know pragma \no-cache etc could have worked had it been in each and every JSP \ Servlet.But its not there and it is not feasable to change so many servlets \ JSPs
NOW !!! What can be done.
How do we clear the Browser history on Log out so that earlier pages are not seen.
Thanks in advance,
Milan Doshi
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Logging out problem in JSP
 
Similar Threads
How to take back the user to his personal page after a refresh
Session Tracking
how to make logout page?
Session timeouts or JsessionIds
how to design logout page?