Cookie cook =CookieUtil.getCookieByName(request, "userinfo"); //userinfo是cookie的名字
if(cook==null){
request.setAttribute("count",count);
}else{
HashMap<String,String> map = new HashMap<String, String>();
String userinfo = CookieUtil.getCookieByName(request, "userinfo").getValue();
userinfo = URLDecoder.decode(URLDecoder.decode(userinfo,"utf-8"),"utf-8");
String[] info = userinfo.split("&");
for(int i=0; i<info.length; i++){
map.put(info[i].split("=",-1)[0], info[i].split("=",-1)[1]);
}
String soufunid = map.get("userid");
if(cook==null){
request.setAttribute("count",count);
}else{
HashMap<String,String> map = new HashMap<String, String>();
String userinfo = CookieUtil.getCookieByName(request, "userinfo").getValue();
userinfo = URLDecoder.decode(URLDecoder.decode(userinfo,"utf-8"),"utf-8");
String[] info = userinfo.split("&");
for(int i=0; i<info.length; i++){
map.put(info[i].split("=",-1)[0], info[i].split("=",-1)[1]);
}
String soufunid = map.get("userid");
String userphone = map.get("phone");
}