This JSP code doesn't return the same getMaxAge(). Any idea why, and how can I fix that?
Cookie cookie = new Cookie("test", "some value"
cookie.setMaxAge(86400);
response.addCookie(cookie);
try
{
Cookie[] cookies = request.getCookies();
for (int i=0; i<cookies.length; i++)
if (cookie.getName().equals("test")
out.print("1st result:"+ cookie.getValue() +"___"+ cookie.getMaxAge() +"<br />"
out.print("2nd result:"+ cookie.getValue() +"___"+ cookie.getMaxAge() +"<br />"
}
catch(Exception e)
{
}
Cookie cookie = new Cookie("test", "some value"
cookie.setMaxAge(86400);
response.addCookie(cookie);
try
{
Cookie[] cookies = request.getCookies();
for (int i=0; i<cookies.length; i++)
if (cookie.getName().equals("test")
out.print("1st result:"+ cookie.getValue() +"___"+ cookie.getMaxAge() +"<br />"
out.print("2nd result:"+ cookie.getValue() +"___"+ cookie.getMaxAge() +"<br />"
}
catch(Exception e)
{
}