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
What is the difference between context parameter and context attribute?
Define servlet mapping?
How do you invoke a Servlet? What is the difference between doPost method and doGet method?
Differentiate between the get and post method
How do we call one servlet from another servlet?
What's the advantages using servlets than using cgi?
Define the lifecycle for executing a jsp page.
Which protocol will be used by browser and servlet to communicate
What is the difference between the http servlet and generic servlet?
What is api in servlet?
What is the directory structure of a war file?
What is Request Dispatcher?
How do you communicate in between Applets and Servlets?
Which event is fired at the time of project deployment and undeployment?
What is a web application and what is it’s directory structure?