How do you delete a Cookie within a JSP?

Q

How do you delete a Cookie within a JSP?

✍: Guest

A

Cookie mycook = new Cookie("name","value");
response.addCookie(mycook);
Cookie killmycook = new Cookie("mycook","value");
killmycook.setMaxAge(0);
killmycook.setPath("/");
killmycook.addCookie(killmycook);

2013-08-10, 1592👍, 0💬