Why setMaxAge() and getMaxAge() methods are used in Cookies?

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

how the HTML data stored in web server?

1952


What is the life cycle of a servlet?

785


What is java servlet?

608


Which interface should be implemented by all servlets?

698


Explain jsessionid and when is it created?

597






Can we override destroy method in servlet?

497


What is the difference between sendredirect() and forward() in a servlet?

525


hi actully i hav form columns with origin and destination names .as like as i need to create one more column with name amount. my requirement is when i select origin and destination columns automatically i need to get amount from database.how can i. please tel me with relative code

2282


Why filter is used in servlet?

526


What do you mean by request dispatcher in servlet? Also explain its methods.

607


How we can create war file in servlet?

660


How we can call a jsp from the servlet?

531


Why do we have servlet listeners?

597


What are the functions of the servlet container?

1030


How many objects of a servlet is created?

788