You should be using the addCookie method of HttpServletResponse and the
Cookie bean, both from javax.servlet.http:

Cookie c = new Cookie( "name", value);
c.setVersion( int v);
c.setDomaon( String pattern);
c.setMaxAge( int expires);
c.setPath( String uri);
c.setSecure( boolean flag);
c.setComment( String comment);
c.setValue(String newValue);
response.addCookie( c);

Of course, you do not have to set all properties.

Cheers!
Mark

----- Original Message -----
From: "Jay Wright" <[EMAIL PROTECTED]>
Sent: Monday, January 21, 2002 4:58 PM


> I am trying to set a cookie in the response object, with the code:
>
> response.addHeader("Set-Cookie", "this=that");
>
> Unfortunatley, there is no expiration time set, so when the cookie comes
> through it is treated as a session cookie and not stored.  Is there syntax
> that would allow this cookie to be set with an expiration date (for
example:
> one month)?
>
> Thanks,
> Jay

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to