In your "save preferences" action, after the user has just updated their
preferences, try:
javax.servlet.http.Cookie c = new javax.servlet.http.Cookie("preference",
"widget");
response.addCookie(c);
and then when they visit the page next time using "ammend preferences"
action:
Cookie[] cookies = request.getCookies();
Cookie c = null;
for (int i=0; i < cookies.length; i++) {
if ("preference".equals(cookies[i].getName())) c = cookies[i];
}
Regards,
Chris.
-----Original Message-----
From: Hong Xing [mailto:[EMAIL PROTECTED]]
Sent: 18 December 2001 15:12
To: [EMAIL PROTECTED]
Subject: How to realize it?
I have built a user's preferences page. Users can change those
preferences. And I want to set a cookie to store that information. When
user goes to the preferences page in the future. What he modified last
time will display on the screen. How to realize it?
I used form bean in the preferences page. So can I generate a form bean
which I used in the preferences page and put the cookies' information
into it? Then the page will display users' last modification.
Please help me.
P.S. I'm sorry for my poor English. :)
Sincerely,���� Hong Xing
--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>