Changing the default session timeout with Tomcat

You can specify the session timeout in your web.xml deployment descriptor. The <session-timeout%gt; tag specifies the number of minutes of inactivity that the container will allow before the HttpSession object becomes invalid.

eg.

    <session-config>
        <session-timeout>
            30
        </session-timeout>
    </session-config>

You can also set your own timeout interval in your servlet or jsp:

<html>
<body>
<% 
   session.setMaxInactiveInterval(30);
%>
</body>
</html>