Why setMaxAge() and getMaxAge() methods are used in Cookies?
Answer Posted / 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 |
Post New Answer View All Answers
Explain the steps involved in placing a servlet within a package?
What is the use of java servlet api?
What is cookie in servlet?
Why is it that we can't give relative URL's when using ServletContext.getRequestDispatcher() when we can use the same while calling ServletRequest.getRequestDispatcher()?
What is servlet mapping?
What’s the difference between sendredirect and forward methods
Which is better jsp or servlet?
Why doesn’t a servlet include main()?
What do you mean by annotations in servlet?
What is the use of servletconfig interface?
Can you refresh servlet in client and server-side automatically?
Are Servlets Thread Safe? How to achieve thread safety in servlets?
How do we share data using 'getservletcontext ()?
What are different ways for servlet authentication?
What methods do you use in servlet - applet communication?