how to remove cookies thru JSP

2002-05-15 Thread Deep Singh Bhau

hi,

I'm using tomcat and I have set the cookies thru JSP. All i want to know
is that after setting the cookie how can i remove it from the client
machine.

regards,
Deep

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




Cookies in JSP

2001-02-27 Thread Herchel Wojciech

Hello!

I hava JDBCRealm auth, and want to store user's last_accessed time. i
thought cookies would be good for that. my code is as follows:

Locale l = new Locale("pl","PL","UNIX");
  String user = request.getRemoteUser();
String data="";
boolean found = false;
Cookie[] cookies = request.getCookies();
  for (int i = 0; i  cookies.length; i++) {
  Cookie c = cookies[i];
if (c.getName().equals(user)) {
found=true;
data = c.getValue();

c.setValue(DateFormat.getDateTimeInstanceDateFormat.LONG,DateFormat.LONG,l).
format(new Date()));
}   
}

if (!found) {
String bla =
DateFormat.getDateTimeInstance(DateFormat.LONG,DateFormat.LONG,l).format(new
Date());
Cookie newC = new Cookie(request.getRemoteUser(),bla);
newC.setMaxAge(10);
response.addCookie(newC);
}

then variable data would return last_accessed time. but it doesnt! that is a
call to setValue(DateFormat...) is not stored in a cookie for good, only
temporary. only for the new user a new cookie with a proper access time is
stored.

anybody?
thanks.

vVolf

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]