Results 1 to 6 of 6
  1. #1
    javaBee is offline Member
    Join Date
    Jan 2012
    Posts
    12
    Rep Power
    0

    Unhappy session invalidation

    Hello guyz..
    i recently developed a project on employee management in JSP.I am really bad at the session handling.Can any one please help me implement a logout page to my application.

    Links,sample codes,.... any thing will be appreciable.

    Actually i tried some sample codes , but most of them are fake.


  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,424
    Rep Power
    20

    Default Re: session invalidation

    Moved from New to Java

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

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

    Default Re: session invalidation

    What have you tried?
    What didn't work?
    Any errors?
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  4. #4
    javaBee is offline Member
    Join Date
    Jan 2012
    Posts
    12
    Rep Power
    0

    Default Re: session invalidation

    Java Code:
    <%-- 
        Document   : log_out
        Created on : Jul 12, 2012, 10:39:53 AM
        Author     : Sarath
    --%>
    
    <%@page contentType="text/html" pageEncoding="UTF-8"%>
    
    
    <!DOCTYPE html>
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
            <title>JSP Page</title>
        </head>
        <body>
            
            
            <%
            
            System.out.println("USER NAME : "+session.getAttribute("username")+"PASS WORD : "+session.getAttribute("password"));
            session.setAttribute("username",null);
           session.setAttribute("password",null);
           session.invalidate();
            
            %>
            <jsp:forward page="login.jsp"/>
            
            
        </body>
    </html>


    I tried this code.When i click on "Log out" button , the above code executes and , my page will be forwarded to the "login.jsp" page !!

    But the problem is , even if i click on the "logout" button , when i try the "back" button to go back to the previous page it works fine.
    And i dont want this to be happen.Even if the logout is clicked , if a user can go back to his previos page then there is no meaning of putting a logout button.

    I personally thinks so...

    Please help me here with your valuable suggestions....

    Thanx in advnc..
    Last edited by Tolls; 07-24-2012 at 10:25 AM. Reason: Fix code tags

  5. #5
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,424
    Rep Power
    20

    Default Re: session invalidation

    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

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

    Default Re: session invalidation

    That's nothing to do with invalidate.
    Do you have interceptors or anything in your servlets that checks for whether someone is logged in on each page they can hit?
    Do you have the html headers set so the browser doesn't cache the page?

    If neither of those things are done then how do you expect the server to know not to allow someone back to that page?
    Please do not ask for code as refusal often offends.

    ** This space for rent **

Similar Threads

  1. How to Invalidate back navigation in browser after session invalidation
    By krishnareddy in forum JavaServer Pages (JSP) and JSTL
    Replies: 0
    Last Post: 01-31-2012, 09:17 AM
  2. problem in session invalidation.
    By Jagdeesh123 in forum Java Servlet
    Replies: 3
    Last Post: 12-06-2010, 05:05 PM
  3. Replies: 1
    Last Post: 04-22-2009, 12:20 AM
  4. Replies: 1
    Last Post: 03-10-2009, 02:12 PM
  5. Replies: 2
    Last Post: 12-23-2008, 07:35 PM

Posting Permissions

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