哪位大神逐行解释一下?有点稀里糊涂的!感谢!!
String list =""; Cookie[] cookies = request.getCookies(); if(cookies!=null&&cookies.length>0) { for(Cookie c:cookies) { if(c.getName().equals("ListViewCookie")) { list = c.getValue(); } } } list+=request.getParameter("id")+","; //如果浏览记录超过1000条,清零. String[] arr = list.split(","); if(arr!=null&&arr.length>0) { if(arr.length>=1000) { list=""; } } Cookie cookie = new Cookie("ListViewCookie",list); response.addCookie(cookie);
cookie这一章确实还需再看几遍