Thursday, March 27, 2008

Session timeout VS setMaxInactiveInterval

           

Fact

Web.xml

Method in HttpSession

How to specify

The <session-timeout> element defines the default session timeout interval

setMaxInactiveInterval(int)

Unit

minutes

Seconds

Exact syntax

<session-config>
<session-timeout>10</session-timeout>
</session-config>

 

public void setMaxInactiveInterval(int seconds)

 

How to never expire

 A negative value or zero value causes the session never to expire.

 

If a negative value is passed to this method, the session will never time out.

 

Applicable

for all sessions created in the Web application

Only for Session explicitly created for the particular request

Design Aspect

Declarative way

Programmatic way

 

            What happens when you set setMaxInactiveInterval(0) --------------------? Think.

 

 

No comments:

Post a Comment