Try adding cookie.setPath("/"); before adding the cookie to the response.
(*Chris*)
----- Original Message -----
From: "Paul Wallace" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, March 06, 2002 10:43 PM
Subject: [JSP-INTEREST] cookie retrieval
> Hi, a have a JSP page to setup a cookie:
>
> cook = new Cookie("memberCookie", userid);
> response.addCookie(cook);
> response.sendRedirect("http://myhost/mydir/somelocation/enterDate.jsp");
>
> and the page to retrieve the cookies (enterDate.jsp):
>
> Cookie cookies[] = request.getCookies();
> if(cookies != null) {
> for(int i = 0; i < cookies.length; i++) {
> if (cookies[i].getName().equals("memberCookie"));
> out.println("Welcome: " + cookies[i].getValue());
> }
> }
>
> Here's the conundrum..if the cookie is retrieved from a DIFFERENT page
that
> setup the cookie, the output (getValue, getName etc) returns only a
session
> ID ie "JSESSIONID ASFK459FH32LJAD0TLJFV93GDG". BUT, if the cookie is
> retrieved from a file in the SAME directory of setup, the desired output
is
> obtained (plus the same JSESSIONID info that can be discarded). Surely I
do
> not have to setup or retrieve cookies from 2 sources/files that are in the
> same directory?
>
> Thanks for all input
>
> Paul.
>
>
===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
DIGEST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
> http://archives.java.sun.com/jsp-interest.html
> http://java.sun.com/products/jsp/faq.html
> http://www.esperanto.org.nz/jsp/jspfaq.jsp
> http://www.jguru.com/faq/index.jsp
> http://www.jspinsider.com
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:
http://archives.java.sun.com/jsp-interest.html
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.jsp
http://www.jguru.com/faq/index.jsp
http://www.jspinsider.com