Servlets + Jsp

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • abctech
    New Member
    • Dec 2006
    • 157

    #1

    Servlets + Jsp

    Hi all, I m a newbie and new to this site as well, I am working on a webapplication using Servlets,Jsp and JavaScript..the user logs into my application and after finishing his task he logs out,but even after logging out i.e(session.inv alidate()) by saying back he can see the previous page when in turn he should be getting a 'you are logged out' or 'session expired message' ..can anyone help me with this ...Thanks in advance!
  • Shanaj
    New Member
    • Jan 2007
    • 51

    #2
    Originally posted by abctech
    Hi all, I m a newbie and new to this site as well, I am working on a webapplication using Servlets,Jsp and JavaScript..the user logs into my application and after finishing his task he logs out,but even after logging out i.e(session.inv alidate()) by saying back he can see the previous page when in turn he should be getting a 'you are logged out' or 'session expired message' ..can anyone help me with this ...Thanks in advance!
    hello,

    just try this

    <%
    response.setHea der("Cache-Control","no-cache"); //HTTP 1.1
    response.setHea der("Pragma","n o-cache"); //HTTP 1.0
    response.setDat eHeader ("Expires", 0); //prevents caching at the proxy server
    response.setHea der("Cache-Control","no-store"); //HTTP 1.1
    %>

    <%
    if(session.getA ttribute("userI d")==null)
    {
    res.sendRedirec t("../error.html");
    }
    %>

    Comment

    • abctech
      New Member
      • Dec 2006
      • 157

      #3
      Hi Shanaj,

      Thanx fr replyin, but actually i'd already used these headers in my page, still not working. I have designed my page using Front-page so I hd jst set these headers as Meta tags with the 'HTTP-EQUIV' attribute..and in my Jsp I'm just checking the session obj , as far the processing is concerned , all that is done in a Servlet,

      The thing is that I've a webappln in wich a user after logging in fills up certain subscriptions and there is a 'logout' link on every page,on clicking it the user's session is invalidated saying session.invalid ate() . Then on all the pages I just check if the session = null , if yes then the user should be redirected back to the home-page..but the thing is that on saying back the control doesn't even go into the scriptlet in order to chek this..it just directly displays the previous page ...and thus u cn see all the previous pages just by saying 'previous' and 'forward'. I' m still working on it and as a temp solution I've disabled the ''back' button thru JavaScript.
      -------------------------------------------------------------------------------------------------------------------




      Originally posted by Shanaj
      hello,

      just try this

      <%
      response.setHea der("Cache-Control","no-cache"); //HTTP 1.1
      response.setHea der("Pragma","n o-cache"); //HTTP 1.0
      response.setDat eHeader ("Expires", 0); //prevents caching at the proxy server
      response.setHea der("Cache-Control","no-store"); //HTTP 1.1
      %>

      <%
      if(session.getA ttribute("userI d")==null)
      {
      res.sendRedirec t("../error.html");
      }
      %>

      Comment

      Working...