如何获取cookie中的secure对象的值

2024-11-04 10:43:05
推荐回答(1个)
回答1:

获取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()); //获取值
}
}