Help catching session timeout in spring

12,273

You can add error-page binding to HttpSessionRequiredException which will redirect to first page in your application

example:

web.xml

<web-app>
    <error-page>
        <exception-type>org.springframework.web.HttpSessionRequiredException</exception-type>
        <location>/index.jsp</location>
    </error-page>
</web-app>
Share:
12,273
blong824
Author by

blong824

I am a Developer in Phoenix, AZ. I have experience working with Java, Spring, Javascript, Html5, and CSS3. I enjoy golfing, reading, learning new things, and spending time with my wife and daughter.

Updated on June 04, 2022

Comments

  • blong824
    blong824 almost 2 years

    I have a simple Spring 3 MVC application. I am using a sessionAttribute and everything works fine except when I let the page sit for 30 minutes or longer. I then get a

    org.springframework.web.HttpSessionRequiredException

    telling me my object is not found in session.

    I am thinking I need to somehow redirect back to the same page when a session timeout occurs. I am not sure how to do this correctly with spring.

    There is no login required and I am already checking if the object is null.

    Any suggestions would be appreciated.

    Thanks