cookie存储,杀死

存储 Cookie c = new Cookie("userid", userid);
Cookie c1 = new Cookie("password", password);
c.setMaxAge(60 * 60 * 24 * 7);
c1.setMaxAge(60 * 60 * 24 * 7);
c.setPath(request.getContextPath());
c1.setPath(request.getContextPath());
response.addCookie(c);
response.addCookie(c1);

------------------------------------------------
杀死 Cookie c = new Cookie("userid", null);
Cookie c1 = new Cookie("password", null);
c.setMaxAge(60 * 60 * 24 * 7);
c1.setMaxAge(60 * 60 * 24 * 7);
c.setPath(request.getContextPath());
c1.setPath(request.getContextPath());
response.addCookie(c);
response.addCookie(c1);

你可能感兴趣的:(cookie存储,杀死)