File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes problem with cookies.Here's the code. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "problem with cookies.Here Watch "problem with cookies.Here New topic

problem with cookies.Here's the code.

puja shaw
Ranch Hand

Joined: Nov 06, 2012
Posts: 32
i am trying t use cookies in servlets.Everytime i am trying to check the condition such as if(cookie==null).This condition is never getting satisfied even after clearing all the cookies of that browser and sending request for the first time.How do i satisfy the condition???

Cookie[] cookie = request.getCookies();

if(cookie==null){out.println("there are no cookies in the browser");}

the above if condition is never getting satisfied.
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13037
Exactly how are you getting this reference "cookie"?

Without more code we have no idea what you are trying to do.

I agree. Here's the link:
subject: problem with cookies.Here's the code.
jQuery in Action, 3rd edition