获取cookies的简单代码(总结待续)

Cookie[] cookies = request.getCookies();
  Cookie cookie = null;
  for (int i = 0; i < cookies.length; i++) {
   cookie = cookies[i];
   if (cookie.getName().equals("username")) {
    out.println("用户名:" + cookie.getValue());
   }
   if (cookie.getName().equals("lastTime")) {
    out.println("上次登录时间:" + cookie.getValue());
   }
  }

 

 

 

 

待续……

posted on 2016-04-26 09:31  灰灰+灰灰  阅读(321)  评论(0编辑  收藏  举报

导航