can any one please clear my doubt about session timeout.In HFSJ it was mentioned like this, if we give -1 as session timeout value the session will never expire.Is it true.
I am doubtful about it.If any one knows please share your knowledge.
adv thanks, vijayasaradhi duggirala
Zaheer A Baloch
Greenhorn
Joined: Jan 24, 2008
Posts: 18
posted
0
Yes! It is true. Please do not doubt what the HFSJ book has to say. Its a religous book for SCWCD and it contains words of truth. Just kidding, its always good to get doubts cleared.
There are two ways we can make sure the session never expires.
Through web.xml:
No doubts, HFSJ is correct and It happeans as it is.If you still have doubts then develop a small app and test it practically.Then you will never forget
Chamara D. Jayaweera
Bachelor of Computer Science
SCJP,SCMAD,SCWCD,SCBCD
Cristian Daniel Ortiz Cuellar
Ranch Hand
Joined: Feb 02, 2011
Posts: 80
posted
0
Chamara Jayaweera wrote:Hi,
No doubts, HFSJ is correct and It happeans as it is.If you still have doubts then develop a small app and test it practically.Then you will never forget
hey guys if i make make either in DD or in code -1 Or any negative number the session will never expire??
if i put on the DD a value of 0. what would happen? the session is invalidate inmediataly???
sorry by my poor english.
thanks..
mohana krishna
Greenhorn
Joined: Apr 12, 2005
Posts: 8
posted
0
If Session-timeout in DD is 0 then session will never expire
mohana krishna wrote:If Session-timeout in DD is 0 then session will never expire
Hmm interesting, the 0 value's behavior is not specified in JavaEE 5 documentation but it is in JavaEE 6 documentation. I'll have to check the servlet specification 2.4 if 0 timeout is specified in it but if its not then it will not be asked in SCWCD 5 exam...
"The session-timeout element defines the default
session timeout interval for all sessions created
in this web application. The specified timeout
must be expressed in a whole number of minutes.
If the timeout is 0 or less, the container ensures
the default behaviour of sessions is never to time
out. If this element is not specified, the container
must set its default timeout period."
So If Session-timeout in DD is 0 then session will never expire.
EE5 "Specifies the time, in seconds, between client requests before the servlet container will invalidate this session.
A negative time indicates the session should never timeout. "
EE6 "Specifies the time, in seconds, between client requests before the servlet container will invalidate this session.
An interval value of zero or less indicates that the session should never timeout."
Sharad Kharya
Ranch Hand
Joined: Oct 15, 2008
Posts: 54
posted
0
It can be set-up in the deployment descriptor:
--- minutes (<= 0, session should never expire)
- Individual session, setMaxInactiveInterval(int seconds) --- seconds (<0 never expire, 0 expire immediately).
If you define values in DD and in code then the value specified in code will override the session timeout for that session.