设置cookie
if(cookieValue==null||cookieValue.equals("")) {cookieValue="-"+tid+"-";}
else{ cookieValue="-"+tid+cookieValue.replaceAll("-"+tid+"-","-");}
//out.println("cookieValue="+cookieValue);
cookie=new Cookie(cookieName, cookieValue);
cookie.setMaxAge(3600);
response.addCookie(cookie);
获得cookie
String cookieName="LatestViewType";
String cookieValue="";
Cookie cookies[]=request.getCookies();
Cookie cookie=null;
if(cookies!=null){
for(int i=0;i cookie=cookies[i];
if(cookie.getName().equalsIgnoreCase(cookieName)){
cookieValue=cookie.getValue();
break;
}
}
}