cookie存储,杀死

来源:互联网 发布:艾珺aj的淘宝店铺 编辑:程序博客网 时间:2024/05/08 06:37

存储 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);
0 0
原创粉丝点击