Can't add cookies on Localhost
807598Feb 3 2006 — edited Feb 3 2006Hi,
I am trying to save cookie and then read it in the same JSP page. But I can't read it, not sure if its been added. Here is the script below:
Cookie c = new Cookie("Test", "123455");
c.setMaxAge(-1);
response.addCookie(c);
Cookie[] allCookie = request.getCookies();
if (allCookie != null)
{
for (int i =0; i< allCookie.length; i++)
{
Cookie c = allCookie;
System.out.print (i+" Name:" + allCookie[i].getName());
System.out.print (" Value:" + allCookie[i].getValue());
System.out.print(" Domain: "+allCookie[i].getDomain());
System.out.println(" Path: "+allCookie[i].getPath());
System.out.println(" MaxAge: "+allCookie[i].getMaxAge());
Where is this cookie is saved? Can I see manually if its been added? Also, the cookie showing(not "Test"), has domain and path as "null". Thanks.