Java examples for Servlet JSP:Cookie
delete cookie from HttpServletResponse
import javax.servlet.http.Cookie; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class Main{ public static void delete(HttpServletResponse response, String cookieName) {/* ww w . j a v a 2 s . c o m*/ Cookie eraser = new Cookie(cookieName, null); eraser.setMaxAge(0); response.addCookie(eraser); } }