Suppose in web.xml file we are given 30 and in the servlet program we are given setSessionInActiveInterval(40).when that session will be terminated ? After 30 sec or 40 sec?

Showing Answers 1 - 10 of 10 Answers

amit

  • Oct 21st, 2005
 

session will be terminated depending upon the later updation means it depend upon the xml file and it will take 40 sec because after compiling it will update xml file into 40 sec

  Was this answer useful?  Yes

Though the session will expire after 40 mins it will not update the xml file after compile. The servlet will load with 30 mins session timeout from web.xml and then update the object with 40 mins.

  Was this answer useful?  Yes

yogesh249

  • Jun 30th, 2010
 

setMaxInactiveInterval specifies the maximum time, in seconds, that you want to allow between client requests for this session.

When configuring in web.xml

<web-app>
.
.
.
<session-config>
         <session-timeout>30</session-timeout>
</session-config>
.
.
.
</web-app>

Here the unit is in minutes.

So, now it is 30 minutes and 40 seconds.

setMaxInactiveInterval takes precedence over the settings that is configured in web.xml

So, here 40 seconds will be considered and 30 minutes will be ignored.

**Mind it, it will not update web.xml ***

Regards
Yogesh

  Was this answer useful?  Yes

yogesh249

  • Jun 30th, 2010
 

session.setMaxInactiveInterval(20*60)

Only the session on which you call the method is affected.

But if you configure in DD (i.e. web.xml) it changes all the sessions of the web-application.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions