Wed 22 Nov 2006
It is easy to read the cookies from a servlet.
Cookies[] getCookies() returns an array of Cookie objects.
// Check for cookies
Cookie[] cookies = request.getCookies();
// Check to see if any cookies exists
if (cookies != null)
{
for (int i =0; i< cookies.length; i++)
{
Cookie aCookie = cookies[i];
System.out.println (“Name : “ + aCookie.getName());
System.out.println (“Value: “ + aCookie.getValue());
}
}
Leave a Reply
You must be logged in to post a comment.


















