> > > <%
> > > //adds a cookie
> > > Cookie c = new Cookie("foo","foobar");
> > > response.addCookie(c);
> > >
> > > //gets the cookies
> > > Cookie[] cookies = request.getCookies();
> > > out.print("# of cookies found = " + cookies.length);
<snip>
>
> Cookies save session information on the client side. This
> can also be done using
> URL rewriting, but to the JSP author, these details can be
> abstracted away using:
>
> <% session.putValue((String)key, (Object)value);
> session.getValue((String)key); %>
>
> The Servlet engine should use cookies if enabled on the
> client, or URL rewriting if
> cookies are not available.
The cookies used to track sessions disappear once the browser is closed (For
Jrun, anyway). So If you need to use a cookie to recognize a user returning
to your site, this solution will not work.
It is a nice way to work things though. Maybe the way that the session
variable works (implementation not specified) could be extended to a
long-living session type object. Then the details of how the cookies are
used could be implemented by the servlet engine?
Or maybe that's taking the abstraction too far?
Eoin.
===========================================================================
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