jQuery in Action, 2nd edition*
The moose likes JSP and the fly likes jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "jsp" Watch "jsp" New topic
Author

jsp

vicneswaran boi
Greenhorn

Joined: Sep 06, 2004
Posts: 13
WAt is wrong with my login page.... when clicked the logout button another login page pops out....and i am unable to close the current pages. i am able to click the back button and i will be brought back to the pages i am viewing.....I dont want this to happen i am not sure abt the codes.

this is the codes...

<HTML>
<HEAD>
</HEAD>

<BODY >
<%

session.invalidate();
response.sendRedirect("Login.jsp");
out.flush();

%>

</BODY>



Thank u very much
Manoj Gundawar
Ranch Hand

Joined: Nov 17, 2002
Posts: 169
Try using forward instead of redirect.
I am doing the same and it works for me.

session.invalidate();
pageContext.forward("logon.jsp");
[ October 05, 2004: Message edited by: Jmannu gundawar ]

Manoj<br />SCJP, SCJD, SCWCD, IBM WSAD.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61095
    
  66

The browser is probably picking up the previously visited pages out of cache. Search this (and perhaps the Servlets forum) for topics on cache and caching and you will find techniques for trying to prevent the browser from caching your pages.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
vicneswaran boi
Greenhorn

Joined: Sep 06, 2004
Posts: 13
Thanks for your reply .... but my logout still does not logout on the same page .... when clicked the logout should redirect me to the login page but in my case the login page pops out....How is this possible and how do i solve it please ...Thks


<HTML>
<HEAD>
</HEAD>

<BODY >
<%

session.invalidate();
pageContext.forward("Login.jsp");


%>

</BODY>
Gert Cuppens
Ranch Hand

Joined: Jul 13, 2003
Posts: 87
If caching is the problem, you should add this as first lines to your JSP.

<%
response.setHeader("Cache-Control","no-cache");
response.setHeader("Expires", "0");
response.setHeader("Pragma", "No-cache");
response.addHeader("Cache-control", "no-store"); // tell proxy not to cache
response.addHeader("Cache-control", "max-age=0"); // stale right away
%>
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: jsp