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 |
What is the difference between the include() and forward() methods?
What is cookies in servlet with example?
What are the advantages of cookies?
How to handle exceptions thrown by application with another servlet?
explain the advantages of servlet life cycle?
Why do we have servlet wrapper classes?
Hi friends am newbie to servlet. How code reusability easy in servlet. why not in jsp . here reusabillity means only javabeans or any thing else.
how this statement works..? public void service(HttpServletRequest request,HttpServletResponse response)
Hi frnd can i any one kindly can post for me portlet,hibernate and spring example application and with flow explantion configuration using Jdeveloper.and related links ar tutorials kindly please send me .its urgent for me .thanks in advance...........else can any one send to kondaiah.goddeti@gmail.com
What are the type of protocols used in httpservlet?
What is meant by a web application
What are the methods in HttpSession and their use?