1.服务器端设置COOKIE
1)Cookie cookie = new Cookie(name, value);
2)cookie.setMaxAge(mills);
3)response.addCookie(cookie);
2.客户端读取cookie
1)ookie[] cookies = request.getCookies();
2)遍历cookies,找到感兴趣的cookie
3.修改cookie的值
1)String cookieValue = cookie.getCookieValue("cookiename“);
try{
int cookieInt = Integer.parseInt(cookieValue);
}catch(NumberFormatException nfe) { }
Cookie c = new Cookie("cookiename", String.valueOf(cookieValue+1));
response.addCookie(c);//不能简单的setValue
2)要指示浏览器删除一个cookie,只需将setMaxAge置为0