|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
JSP: cookie.getMaxAge() doesn't seem to work properly
This JSP code doesn't return the same Max age. 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 (cookies[i].getName().equals("test")) { out.print("1st result:"+ cookies[i].getValue() +"___"+ cookies[i].getMaxAge() +"<br />"); } } out.print("2nd result:"+ cookie.getValue() +"___"+ cookie.getMaxAge() +"<br />"); } catch(Exception e) { } Result is: 1st result:some value___-1 2nd result:some value___86400 Last edited by t360 : May 15th, 2003 at 10:01 PM. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Java Help > JSP: cookie.getMaxAge() doesn't seem to work properly |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|