Discussions

Web tier: servlets, JSP, Web frameworks: sessions problem in JSP

  1. sessions problem in JSP (1 messages)

    I built a JSP inventory, but Im running into a problem with the sessions when I log out.

    I used session.invalidate(); to terminate my session, but if I hit the back button on my browser it will return me to the inventory page.

    Now if I just simply click any link, it will throw me back out to login (which is what its supposed to do when Im not logged in), but if I refresh the inventory page, it refreshes the session and allows me to do anything I want, just as if I had never logged out.

    How can I get around this??? I tried messing with the session-timeout value in my Web.xml, but to no avail. Is there a way I can simply clear the history of the browser once I log off??

    Thanks
    Boki
  2. clear browser history[ Go to top ]

    Hi Bojan,

    It is kind of tricky...you can use below to clear your browser histroy

    <%
        response.setHeader("Pragma","no-cache");
        response.setHeader("Cache-Control","no-cache");
        response.setDateHeader("Expires",-1);
        response.setDateHeader("Last-Modified",0);
    %>

    - Venkatesh Rajmendram