Results 1 to 8 of 8
  1. #1
    01.chetan is offline Member
    Join Date
    Nov 2009
    Posts
    1
    Rep Power
    0

    Post Servelt Session management

    Hello Folks,

    I am facing one problem. I have developed simple client-server application using servlet and jsp. And for log out utility. I used the servlet code snippet as follows

    public void doGet(HttpServletRequest request, HttpServletResponse response) throws
    ServletException, IOException {

    request.getSession().invalidate();

    response.sendRedirect("/sampleapplication/login.jsp");

    }

    And directing browser to login.jsp
    On logn.jsp when user clicks on browser Back button, it shows the previous page from where I executed the log out utility.
    I don't want user to see the page except login.jsp once he logout the session.

    Please help.

    Thanks ,
    -Chetan

  2. #2
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    7

    Default

    Stop the browsers from caching those pages by putting

    Java Code:
    <meta HTTP-EQUIV="Pragma" content="no-cache"> and
    <meta HTTP-EQUIV="Expires" content="-1">

  3. #3
    FON
    FON is offline Senior Member
    Join Date
    Dec 2009
    Location
    Belgrade, Serbia
    Posts
    364
    Rep Power
    5

    Default

    I put code on page with logout link:

    <meta HTTP-EQUIV="Pragma" content="no-cache"> and
    <meta HTTP-EQUIV="Expires" content="-1">

    but nothing happens when i clicked
    BACK and Browser still shows that page
    where log-out is performed:(

    I use Firefox.

    Anyone got no-cache thing to work?
    Which browser?

  4. #4
    bhavitk is offline Member
    Join Date
    Feb 2011
    Posts
    2
    Rep Power
    0

    Default

    i had same problem but i think better solution is to close page on successful log out.

  5. #5
    Rituparna is offline Member
    Join Date
    Feb 2011
    Location
    India
    Posts
    22
    Rep Power
    0

    Default

    Me too facing a similar problem and it's still unresolved. I have tried soo many things.... and nothing works.......

  6. #6
    baloda is offline Member
    Join Date
    Nov 2010
    Location
    New Delhi
    Posts
    50
    Rep Power
    0

    Default

    i had same problem. this code had worked for me

    session=req.getSession(false);
    if(session!=null){
    session.invalidate();
    }


    Java Examples

  7. #7
    bhavitk is offline Member
    Join Date
    Feb 2011
    Posts
    2
    Rep Power
    0

    Default

    i solved problem

  8. #8
    only_java is offline Member
    Join Date
    Mar 2011
    Posts
    16
    Rep Power
    0

    Default Use Cookies

    Dear all,

    Please use cookies for your solution.
    Make cookies when user sign in. Remove cookie when user sign out.
    and check cookie value on every page( you can make one header.jsp and put it once) in <body onload="somefun();">
    if cookies is present process the request if no forward to login page.

Similar Threads

  1. session management
    By rakesh_n_mehta in forum Web Frameworks
    Replies: 7
    Last Post: 09-22-2009, 07:02 PM
  2. Replies: 1
    Last Post: 04-21-2009, 11:20 PM
  3. Replies: 1
    Last Post: 03-10-2009, 01:12 PM
  4. session Management betwwen two application
    By sachin srivastava in forum New To Java
    Replies: 2
    Last Post: 01-21-2009, 05:12 PM
  5. Replies: 2
    Last Post: 12-23-2008, 06: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
  •