wood burning stoves*
The moose likes Servlets and the fly likes Cookie Code Not Working 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 "Cookie Code Not Working" Watch "Cookie Code Not Working" New topic

Cookie Code Not Working

Dale DeMott
Ranch Hand

Joined: Nov 02, 2000
Posts: 515
I'm trying to read and write a cookie. I'm doing this within the action in struts. The code that writes the cookie looks like this...

As you can see.. the last line is doing a findForward because this is inside of an action within struts. For some reason this isn't writing any cookies. Other cookies can be written to my system. I've checked where the cookies are stored and saw other cookies and other valeus being written so it isn't my browser settings. I've looped through all of the cookies in the system. The only cookie that shows up is a JSESSSION cookie

Any help would be appreciated.

By failing to prepare, you are preparing to fail.<br />Benjamin Franklin (1706 - 1790)
Dale DeMott
Ranch Hand

Joined: Nov 02, 2000
Posts: 515
Found this to be some problem w/ the domain and the path. When I removed the domain and path, the cookie wrote fine. Not sure why. When this goes to production though it will definitely have to have the domain and path in place.
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: Cookie Code Not Working
Similar Threads
JSF Example Error
Can someone help me with this exception
struts2.0 example console message
WAS Base JNDI Remote queue connection factory problem
struts2.0 application issues