This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JSP and the fly likes LogOut.jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "LogOut.jsp" Watch "LogOut.jsp" New topic
Author

LogOut.jsp

Gayathri Neti
Greenhorn

Joined: Mar 08, 2002
Posts: 25
I have a web application developed in JSP, TomCat 4.1.18.
In the application, I am logging a user and setting the userId in the session. After the user does whatever he needs to do, he would click on LogOut.
In the LogOut.jsp, I have the following code.
<%@ page language= "java" %>
<%@ page import="javax.servlet.http.HttpSession" %>
<%
if(request.getParameter("logout")!=null){
out.println("called Me");
session.removeValue("loginid");
session.removeValue("isadmin");
session.invalidate();
}
response.sendRedirect("login.jsp");
%>
My problem is that 'login.jsp' is never being called. Instead, it's staying on the screen from where I clicked 'LogOut'.

Can any body help me?? :roll:
Praful Thakare
Ranch Hand

Joined: Feb 10, 2001
Posts: 614
Hi Gayathri ,
i dont think there is any problem in logout.jsp
could u post ur code where there is link for logout.jsp!!!
And if at all logout.jsp is called only when u wish to logout then i dont think there is need of
if(request.getParameter("login")!=null)
regards


All desirable things in life are either illegal, banned, expensive or married to someone else !!!
Gayathri Neti
Greenhorn

Joined: Mar 08, 2002
Posts: 25
Yeah, you are correct. I was trying all different things to debug it.
OK..here it is. I am pasting a part of the main page. The main page doesn't have any JSP in it.
<%! String logout = "true"; %>
<table width="90%" height="80%" border="0" cellpadding="0" cellspacing="0" bordercolor="#003399" >
<tr>
<td height="31" align="center"><a href="LogOut.jsp?logout=<%=logout%>" ><font color="#FFFFFF" size="2" face="Verdana, Arial, Helvetica, sans-serif">Log Out </font></a></td>
</tr>
Thanks.
David Hibbs
Ranch Hand

Joined: Dec 19, 2002
Posts: 374
I don't see anything wrong in what you posted... have you checked your server stderr and stdout for messages? A blank screen sounds like there was probably an exception of some kind. Or, maybe a 404 occurred sending you to a custom 404 mask which is blank? So some other questions...
Do you have a custom 404 mask defined?
Do you have a custom error page defined?
What does the login page do when a user hits it the first time?
Have you checked your access log to see what page was requested?
Maybe these items will give you some ideas where to look...


"Write beautiful code; then profile that beautiful code and make little bits of it uglier but faster." --The JavaPerformanceTuning.com team, Newsletter 039.
 
 
subject: LogOut.jsp
 
Similar Threads
session problem
JSP not cached using jsp:forward from it
How to disabel the back and forward after session is invalidated
Basic page logout design
controlling browsers back button