Java examples for Servlet JSP:Cookie
remove servlet Cookie
import javax.servlet.http.Cookie; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class Main{ public static void removeCookie(HttpServletResponse response, String name) {/*from w ww . j a va 2 s . c om*/ Cookie cookie = new Cookie(name, ""); cookie.setHttpOnly(true); // Tell browser to not make this cookie available to javascript. cookie.setMaxAge(0); cookie.setPath("/"); response.addCookie(cookie); } }