This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have Dawn & David Griffiths on-line!
See this thread for details.
The moose likes Servlets and the fly likes Cookie Problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Cookie Problem" Watch "Cookie Problem" New topic

Cookie Problem

Angela Poynton
Ranch Hand

Joined: Mar 02, 2000
Posts: 3143
I'm using the following code to check for the exisitance of a cookie, if it doesn't exist a new one is created with the value of a countrychoicecode passed in.
If a cookie already exists I want to modify the countrychoicecode and rewrite the cookie.
The problem is that when I try to modify the cookie and rewrite it the cookie dissappears.
Anyone experienced this before or see where i'm going wrong?
FYI the RequestHelper class used here is used to get hold of a specific cookie from the HttpRequest, this is working fine.

[This message has been edited by Angela Poynton (edited August 21, 2001).]

Pounding at a thick stone wall won't move it, sometimes, you need to step back to see the way around.
Angela Poynton
Ranch Hand

Joined: Mar 02, 2000
Posts: 3143
Can anyone help me here? This is getting really frustrating!
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16897

Just as a quick check - are you writing out anything BEFORE you get to this code? Cookies are header constructs.

Customer surveys are for companies who didn't pay proper attention to begin with.
Angela Poynton
Ranch Hand

Joined: Mar 02, 2000
Posts: 3143
Hmmm you may have it there .... this code is in a Servlet which is called by the FORM ACTION directive in a JSP ... this JSP is included by a template JSP.
Tricky ...
subject: Cookie Problem
It's not a secret anymore!