客户端缓冲数据技术
将数据储存在客户端,每次请求都携带Cookie数据进行访问

发送Cookie

  1. Cookie cookie = new Cookie("username","zs");
  2. resp.addCookie(cookie);

获取Cookie

  1. Cookie[] cookies = req.getCookies();
  2. for (Cookie cookie : cookies){
  3. String name = cookie.getName();
  4. String value = cookie.getValue();
  5. }