服务器端得到cookie
1.
getname 获取key getvalue 获取值
Cookie[] cookie = request.getCookies();
response.getWriter().write("cookie获取成功!");
for(Cookie cookie1:cookie)
{
response.getWriter().write(cookie1.getName()+cookie1.getValue()+cookie1.getPath());
}
当我们想要得到某个cookie的时候 可以将其封装成一个工具类
Cookie IwantCookie=null;
if("key".equals(cookie1.getName())){
IwantCookie=cookie1;
response.getWriter().write(IwantCookie.getValue()+"</br>");
}
if(IwantCookie!=null)
System.out.println("找到了");