Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Apr 2008
    Thanked 0 Times in 0 Posts

    session invalidate in logout

    Hi ,
    I am having a logout link when clicked it redirects to the login.jsp page.
    I have to invalidate the session when the logout link is clicked. (I cannot have a logout.jsp page to invalidate the session there).

    How can I invalidate the session.
    If I want to do it in the bean how would I be able to do that ??
    Please provide the code for invalidating the session (any way except for using the logout as a different jsp page), so that if a user logs out , he would not be able to directly enter the jsp page.


  • #2
    New to the CF scene
    Join Date
    Apr 2008
    Montevideo, Uruguay
    Thanked 0 Times in 0 Posts
    If you cannot have the user navigate through a logout servlet or JSP page (which would seem as the easiest way), what you can do is set a parameter on the login.jsp page at session scope:

    <&#37; request.getSession().setAttribute("loggedIn", "no"); %>

    and then set it to "yes" when the user successfully logs in. Then you should check on every page (maybe better using a filter on your web.xml) for the existance and correct value ("yes") of this parameter.


    Posting Permissions

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