java - Spring MVC HttpServletResponse not overwriting cookie -


every time different page requested, following:

    cookie cookie = new cookie("c1", somestring); // can {a, b, c}, example     cookie.setmaxage(31556926);     response.addcookie(cookie);      cookie = new cookie("c2", integer.tostring(someint));     cookie.setmaxage(31556926);     response.addcookie(cookie); 

but when visit page /page/a, visit page /page/b (both of goes same method controller) notice cookies (from web dev console in chrome) has new cookie before old cookie... causing old cookie used client. i've tested in firefox. doing wrong?

it turned out needed specify correct path cookie, set cookie's path /


Comments

Popular posts from this blog

python - Installing PyDev in eclipse is failed -

PHP OOP-based login system -

c# - Nested Internal Class with Readonly Hashtable throws Null ref exception.. on assignment -