In spring mvc 3, how to write a cookie while returning a ModelAndView?

前端 未结 4 621
心在旅途
心在旅途 2020-12-24 07:59

My controller method is returning a ModelAndView, but there is also a requirement to write a cookie back to client. Is it possible to do it in Spring? Thanks. <

4条回答
  •  离开以前
    2020-12-24 08:34

    Not as part of the ModelAndView, no, but you can add the cookie directly to the HttpServletResponse object that's passed in to your controller method.

提交回复
热议问题