dcsimg
Problems reading a Cookie in a JSP page that was written by a Serlvet
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Eric_Getchell
Posted On:   Thursday, April 15, 2004 04:53 PM

For local development, I'm running a Tomcat 3.2.x, the built-in webserver with Tomcat, and testing with IE 5.0. I'm having a problem in that cookies written within a Servlet can only be read by other Servlets. However, if I try and read the same cookie from within the context of a JSP page, I don't find it. After much hair pulling, I noticed that the cookies read/written from a Servlet have the following domain name: administrator@servlet And that Cookies read/written from the JSP context have this domain name: administrator@localhost I tried issuing a setDomain on the cookie before it was written, but that causes IE to throw the cookie out and not write it at all.    More>>

For local development, I'm running a Tomcat 3.2.x, the built-in webserver with Tomcat, and testing with IE 5.0.



I'm having a problem in that cookies written within a Servlet can only be read by other Servlets. However, if I try and read the same cookie from within the context of a JSP page, I don't find it.



After much hair pulling, I noticed that the cookies read/written from a Servlet have the following domain name: administrator@servlet



And that Cookies read/written from the JSP context have this domain name: administrator@localhost



I tried issuing a setDomain on the cookie before it was written, but that causes IE to throw the cookie out and not write it at all.



Does anyone have any hints that would allow me to accomplish the above?



Thanks,



Eric

   <<Less

Re: Problems reading a Cookie in a JSP page that was written by a Serlvet

Posted By:   Eric_Getchell  
Posted On:   Friday, April 16, 2004 07:10 PM

I'll answer my own question in case someone else gets hung up with this problem.



I ended up issuing a Cookie.setPath("/") when writing the cookie. Then the cookie was visible between Servlets and JSP pages.
About | Sitemap | Contact