Reputation: 333
I am working on jsp and came across "cookies". I am aware of the functions related to getting, setting or checking cookies and also the expiry period setting is clear to me. But just for the knowledge point of view, I wanted to know if there is any default expiry period for a cookie, in case i don't set it manually? I tried Google, but could find absolutely no answers for this particular part. I will really appreciate if anyone can throw some light on it.
Upvotes: 2
Views: 4709
Reputation: 23
The default lifetime of a cookie set in a JSP page is the current browsing session only. Once you restart the browser,the cookie no longer exists.
Upvotes: 2
Reputation: 1753
The default Expires value for a cookie is not a static time, but it creates a Session cookie. This will stay active until the user closes their browser/clears their cookies. You can override this as required.
Check this link(it isnt jsp but will help you)
http://msdn.microsoft.com/en-us/library/system.net.cookie.expires%28VS.80%29.aspx
Setting the Expires property to MinValue makes this a session Cookie, which is its default value
Check this tutorial on cookies
http://www.tutorialspoint.com/jsp/jsp_cookies_handling.htm
This will surely help you
Upvotes: 0