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


Please Help Members By Posting Answers For Below Questions

What does the term localization refer to?

574


Does servlet have main method?

676


Explain the war file?

598


Can we use the constructor, instead of init(), to initialize servlet?

572


Why is Servlet so popular?

604






What is httpservlet class?

531


What is servlet container?

651


What is a servlet context?

591


What are the types of protocols supported by httpservlet ?

694


What are the different types of servlets?

508


Explain in brief the directory structure of a web application?

556


Explains the differences between context.getrequestdispatcher() and request.getrequestdispatcher()?

536


What is servlet lazy loading?

681


What is the requirement of servlet config and servlet context implemented and how are they implemented?

532


What are all the advantages of servlet over cgi?

595