This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
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


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "problem with cookies.Here Watch "problem with cookies.Here New topic
Author

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
Rancher

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

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

Bill
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: problem with cookies.Here's the code.