Discussions

Web tier: servlets, JSP, Web frameworks: logout page in JSP-Urgent help me please

  1. logout page in JSP-Urgent help me please (3 messages)

    In my Appl,

    I have a logout page in jsp called logout.jsp.
    After loggin out , if i hit the back button of the browser ...it takes me again to the server.

    if i add

    getSession().invalidate() method and hit the back button ..it gives a server error.

    I need my application to be:

    After loggin out ...if i git the back button...automatically it should take me to login screen.
     



    can any one help.....please.
  2. if you do this in servlet, you could use response.sendRedirect.(I guess you can do this in jsp too)

    try
    ...
    session.invalidate();
    response.sendRedirect("login.html");



    Kari Sarsila
  3. hi
      on each and every page, check whether session exists
      u can include it as a file
      
    <jsp: include file ="some file.jsp">
      use response.redirect(response.EncodeURL("login.html"?)

    try this
    sundar
  4. You Can use JavaScript for this. In the logout page, write a javascript code. This code will take care of back button pressed. WHen back button is pressed then set the url as login.html or to some other page which you want. I think this helps you.