> -----Original Message-----
> From: A mailing list about Java Server Pages specification
> and reference
>
> well it actully works fine, but i faced a problem when i set
> the client
> cookie using Javascript, it worked fine,
>
> but then i tried to access the same in my servelt (i was then using
> JSDK2.0), is this a problem, why does this not work, i checked the
> directory, i saw that my cookie was being stored, in the
> browser's(diff for
> ie and NS, as you know) respective client directory.
>
> when i try to get the cookie i could not access it.
>
> can you pls clarify this also

I'm not sure exactly what you mean but here goes...

You should understand that cookies are sent to the server, from the browser
via an HTTP header field when a matching[1] request is made.

Setting cookies in JavaScript will work from the client point of view, but
these cookies have to be transmitted to the server somehow if you want a
servlet or JSP page to use them (obviously!). Following a cookie set in
JavaScript a subsequent request to the server should ensure that the cookies
(header field) get transmitted to the server.

Anyway, that's my understanding of things.

The other point is that when you create a cookie (in a servlet) you can
specify certain attributes about it - eg how long it should live and whether
it should persist, etc (I can't remember the details off the top of my
head - see the Cookie API docs).
If you don't explictly set these attributes you could find that you are
creating a 'transient' cookie which will not get stored on disc - it only
survives until the browser is shutdown.

[1] Only cookies whose server hostname and path attributes match the current
request are sent to the server.

HTH,

Steve S

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html

Reply via email to