@RequestMapping("/hello2")
public String hello2(HttpServletResponse response){
Cookie cookie=new Cookie("name","瓜田李下3");
cookie.setMaxAge(60);
response.addCookie(cookie);
return "success 2";
}
@RequestMapping("/hello3")
public String hello3(HttpServletRequest request,@CookieValue("name") String name){
System.out.println(name);
Cookie[] cookies=request.getCookies();
for (Cookie cookie:cookies){
System.out.println(cookie.getName()+" "+cookie.getValue());
}
return "success 3";
}