Thanks for your reply,
I have gotten the answer.
I use the following code and it
works.
Cookie c = new Cookie("CookieID",
String.valueOf(new Date().getTime()));
response.addCookie(c);
Jianhong
----- Original Message -----
Sent: Thursday, October 21, 1999 1:49
AM
Subject: Re: Cookie Update
What do you expect should happen? This code tells the browser to
keep the cookie for the specified amount of time, but your web server will
probably be throwing away the session after 30 minutes of inactivity anyway so
having the cookie on hand won't buy you anything.
(*Chris*)
----- Original Message -----
Sent: Tuesday, October 19, 1999 5:48
PM
Subject: Cookie Update
Hi, gurus,
I searched this archive, but didn't find the
answer.
I want to update the cookie which is added
when the user first logged on using the following code, but it has no
use, can anyone tell me why.
Cookie cs[] =
request.getCookies(); if (cs != null) { for (int i=0; i<cs.length;
i++) { if
(cs[i].getName().equals("CookieID")) { bFind
=
true; cs[i].setValue(String.valueOf(new
Date().getTime())); cs[i].setComment(String.valueOf(new
Date().getTime())); cs[i].setMaxAge(60*60*24); break; } } }
Thanks in advance.
Jianhong
|