Set session Validity Period

Source: Internet
Author: User
The default session validity period for Tomcat is 30 minutes. ================================================== You can go to the "tomcat installation directory "/CONF/web. set and view in the XML file.CodeAs follows (the unit of time is minute ): <session-config> <session-Timeout> 30 </session-Timeout> </session-config> ================ ========================== In addition, you can set the Tomcat session validity period in three ways: 1. In tomcat/CONF/web. modify the value of session-timeout in XML, which is the global default of Tomcat; can also be in the WEB-INF/web. set the time used by the application in XML, with Tomcat/CONF/web. the XML settings are identical. 2. on the server. use the following definition when defining context in XML (modify the defaultsessiontimeout value, in seconds ): <context Path = "/livsorder" docbase = "/home/httpd/html/livsorder" defaultsessiontimeout = "3600" iswarexpanded = "true" iswarvalidated = "false" isinvokerenabled = "true" isworkdirpersistent = "false"/> 3.ProgramUsing Servlet API: httpsession ses = request. getsession (); SES. setmaxinactiveinterval (10); // set the unit to seconds and set it to-1 and never expire.

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.