Setmaxinactiveinterval method setting for calling session in a program
Session.setmaxinactiveinterval (30 * 60);
Setmaxinactiveinterval sets the expiration time for the current session, not the entire web, in seconds. If you set a value of zero or a negative number, the session will never timeout.
session-config configuration in Web.xml the session-timeout element is used to specify the default session timeout interval, in minutes. The element value must be an integer. If the value of the session-timeout element is zero or negative, the session will never timeout. For example, set session expiration time to 30 minutes:
<session-config>
<session-timeout>30</session-timeout>
</session-config>
third, directly in the Application server settings
In the case of Tomcat, the <session-config> element can be found in Conf/web.xml in the Tomcat directory, and the Tomcat default setting is 30 minutes.
<SESSION-CONFIG>
<session-timeout>30</session-timeout
</session-config>