Results 1 to 3 of 3
  1. #1
    raj.33jsr is offline Member
    Join Date
    Jul 2010
    Posts
    4
    Rep Power
    0

    Default problem in logout...

    dear all
    i am working with a project where i need to logout a user from his account on clicking logout option .I am using the coad in servlet for log out..


    import javax.servlet.*;
    import javax.servlet.http.*;
    /**
    * Insert the type's description here.
    */
    public class LogOut extends HttpServlet {
    /**
    * Process incoming HTTP GET requests
    *
    * @param request Object that encapsulates the request to the servlet
    * @param response Object that encapsulates the response from the servlet
    */
    public void doGet(HttpServletRequest req, HttpServletResponse res)
    throws ServletException, java.io.IOException {


    res.setHeader("Cache-Control","no-cache"); //HTTP 1.1
    res.setHeader("Pragma","no-cache"); //HTTP 1.0
    res.setDateHeader ("Expires", 0); //prevents caching at the proxy server
    res.setHeader("Cache-Control","no-store"); //HTTP 1.1
    System.out.println("################## in side Logout Class");


    HttpSession session = req.getSession(false);
    if (session != null) {
    session.removeAttribute("userId");
    session.removeAttribute("userPw");
    session.removeAttribute("url");
    session.invalidate();
    }

    res.sendRedirect("./jsps/Login/LogOut.jsp");
    }



    }

    but the problem is after log out when i am clicking the back button of browser it redirects to the account again..
    if any body can help me out than please send me the coad...

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,016
    Rep Power
    20

    Default

    OK.
    Does the page they are going Back to have any security checks on it?

  3. #3
    raj.33jsr is offline Member
    Join Date
    Jul 2010
    Posts
    4
    Rep Power
    0

    Default

    yes in my jsp page i am checking..


    <%
    response.setHeader("Cache-Control","no-cache"); //HTTP 1.1
    response.setHeader("Pragma","no-cache"); //HTTP 1.0
    response.setDateHeader ("Expires", 0); //prevents caching at the proxy server
    response.setHeader("Cache-Control","no-store"); //HTTP 1.1
    %>

    <%
    if(session.getAttribute("username")==null)
    {
    response.sendRedirect("./jsps/Login/LogOut.jsp");
    }
    else{%>
    business logic......
    <%}%>
    still it is not working..

Similar Threads

  1. logout servlet needed
    By nakta in forum Java Servlet
    Replies: 0
    Last Post: 01-09-2010, 01:35 PM
  2. problem in login again after logout
    By Tirka in forum JavaServer Pages (JSP) and JSTL
    Replies: 3
    Last Post: 12-25-2009, 01:37 PM
  3. Dispose a JDesktopPane for logout.
    By hendrix79 in forum New To Java
    Replies: 3
    Last Post: 02-10-2009, 03:09 PM
  4. Logout problem
    By anki1234 in forum JavaServer Pages (JSP) and JSTL
    Replies: 4
    Last Post: 01-09-2008, 07:54 AM
  5. logout using java script
    By pankajagar2001 in forum JavaServer Pages (JSP) and JSTL
    Replies: 1
    Last Post: 01-03-2008, 06:37 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •