Session validity check problem ...


Web tier: servlets, JSP, Web frameworks: Session validity check problem ...

  1. Session validity check problem ... (2 messages)

    Hi !
    I use HttpSession for handling session in my JSP. I had set the max idle time interval for 5 minutes. I should implement a functionality which checks for session validity and should redirect to login page, if expired. How to implement this. Should I check against the session variable for null or should I check with the idle time period. Iam implementing it in multiple frames. Please give a logic with sample code of checking the session validity. Early solution is appreciated.

  2. Session validity check problem ...[ Go to top ]

    you could either use the request.isRequestedSessionIdValid() or check the session variable for null, you could then use a request.sendRedirect to force the page to return to the login page. When you are in multiple frames, you might want to use a javascript jsp combination like top.document.location = <%=yourindexpage.jsp%>. This should ensure that the login page opens in the whole browser window.

  3. sorry about the error in the post above.
    response.sendRedirect should be used instead of request.