This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread 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 Android Security Essentials Live Lessons this week in the Android forum!
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: 12761
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.
Similar Threads
Session Management Problem
Not able to retrieve cookie information
Prevent Duplicate Logins
Disable multiple logins by a user in java web application