Announcement Announcement Module
No announcement yet.
response.addCookie not creating cookie Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • response.addCookie not creating cookie

    sorry, I'm new to Spring, and I know I must be doing something wrong here. How come my cookie isn't being set? I've set IE to prompt for cookies, and nothing is coming back. thanks for any help.

    here's where I try to add a cookie. I'm using a SimpleFormController.

    protected ModelAndView onSubmit(HttpServletRequest request,
    HttpServletResponse response, Object command, BindException errors)
    throws Exception {


    Cookie cookie = new Cookie("counter", "1");


    return new ModelAndView(this.getSuccessView(), "foo", fooObj);

  • #2
    I don't think this is a Spring issue. Maybe you could simplify things and remove the SimpleFormController and use an AbstractController instead?

    Also, you might want to try out the CookieLocaleResolver ( to see if a the locale change interceptor creates a cookie...

    Spring doesn't do anything special when you create a cookie using hte response...