Set session effective Time __session

Source: Internet
Author: User

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>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.