如何取到Set-Cookie中的值
展开全部
// 获取request里面的cookie cookie里面存值方式也是 键值对的方式
Cookie[] cookie = request.getCookies();
for (int i = 0; i < cookie.length; i++) {
Cookie cook = cookie[i];
if(cook.getName().equalsIgnoreCase("eredg4.login.account")){ //获取键
System.out.println("account:"+cook.getValue().toString()); //获取值
}
}
Cookie[] cookie = request.getCookies();
for (int i = 0; i < cookie.length; i++) {
Cookie cook = cookie[i];
if(cook.getName().equalsIgnoreCase("eredg4.login.account")){ //获取键
System.out.println("account:"+cook.getValue().toString()); //获取值
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询