How can I set a cookie and delete a cookie from within a jsp page?



How can I set a cookie and delete a cookie from within a jsp page?..

Answer / Awani Yadav

To set a cookie in JSP, use the response object's Cookie method: n<code>response.addCookie(cookie);</code>n To delete a cookie, set an expiration date in the past.n<code>cookie.setMaxAge(0); response.addCookie(cookie);</code>

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More JSP Interview Questions

Can you call jsp from servlet?

1 Answers  


Give the use of session object.

1 Answers  


How do we prevent browser from caching output of my jsp pages?

1 Answers  


How do I use a scriptlet to initialize a newly instantiated bean?

1 Answers  


How does JSP handle run-time exceptions?

2 Answers   IBM,


What do you know about writing custom jsp tags?

1 Answers  


What is <jsp:usebean> in jsp?

1 Answers  


How do you prevent the creation of a session in a jsp page and why? What is the difference between include directive & jsp:include action?

1 Answers  


How do you comment out in jsp?

1 Answers  


What is difference between custom jsp tags and beans?

1 Answers  


What is contextpath?

1 Answers  


Q : In session created by server with client(browser) How can server find that request coming is belong to new session OR belong to session that is timeout.

4 Answers   HCL,


Categories