Why setMaxAge() and getMaxAge() methods are used in Cookies?
Answers were Sorted based on User's Feedback
Answer / abhijitbaji
setMaxAge(), this function sets the maximum age of the
cookie.
The value of the maximum age is the lifetime of the cookie
in seconds.
It is a decimal non-negative integer.
When the age is greater than seconds of maximum age, the
client SHOULD discard the cookie.
A value of zero means the cookie SHOULD be discarded
immediately.
getMaxAge(), this function can be used to retrieve the
maximum age of the cookie.
| Is This Answer Correct ? | 10 Yes | 1 No |
Answer / tulasi vani
Cookies are created as
Cookie c=new Cookie(name,value);
c.setMaxAge(milliseconds);
int getMaxAge() returns the maximum age of the cookie.
If the value is set to zero it will be deleted
immediately.If the age is a -ve number it states that the
age of the cookie is confined to that particular request
only.
| Is This Answer Correct ? | 2 Yes | 6 No |
Explain the difference between generic servlet and http servlet?
How to get the server information in a servlet?
What is a servlet-to-servlet communcation?
What are the uses of servlet
How do u authorize and authenticate without <auth> of web.xml
please give url to get orinal software for I-net crystal clear java report tools?
How do you invoke a Servlet? What is the difference between doPost method and doGet method?
What are some advantages of storing session state in cookies?
What is servlet and its types?
What is the difference between genericservlet and httpservlet
how many jsp scripting elements are there and what are those?
What do you mean by deployment descriptor?