SpringMVC_6_使用@CookieValue绑定请求中的Cookie值md

  • @CookieValue可让处理方法入参绑定某个Cookie值
  • @CookieValue映射一个Cookie值。属性同@RequestParam相同

举个例子:

1.首先得到当前页面的Cookie名称

在这里插入图片描述

2.写一个标签来调用这个方法

在这里插入图片描述

3.写好这个testCookieValue的方法

在这里插入图片描述

4.运行程序,点击< a >标签,得到结果

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/weixin_42036647/article/details/85292144
今日推荐