Tue 21 Nov 2006
Class javax.servlet.http.cookies can be used to access cookies on the client side. The following code demonstrates this technique. It checks the existence of cookie ‘MyCookie’.
boolean dcookiefound = false;
Cookie[] cookies = request.getCookies();
for(int nIndex=0;nIndex < cookies.length;nIndex++)
{
if(cookies[nIndex].getName().equals(“MyCookieâ€))
{
dcookiefound = true;
//desired cookie found, use it
}
}
if(dcookiefound == false)
{
//cookies not found.
}
Leave a Reply
You must be logged in to post a comment.


















