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

jquery - How do you format the date used in the popover widget title of FullCalendar? -

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -