wood burning stoves 2.0*
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 Murach's Java Servlets and JSP this week in the Servlets 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: 12759
    
    5
Exactly how are you getting this reference "cookie"?

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

Bill
 
jQuery in Action, 2nd edition
 
subject: problem with cookies.Here's the code.
 
Similar Threads
Session Management Problem
cookies
Not able to retrieve cookie information
Prevent Duplicate Logins
Disable multiple logins by a user in java web application