Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

jsp

 
vicneswaran boi
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 169
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64606
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
vicneswaran boi
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
%>
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic