File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

LogOut.jsp

 
Gayathri Neti
Greenhorn
Posts: 25
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 642
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Gayathri Neti
Greenhorn
Posts: 25
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 374
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic