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.
}






