SpringMVC----@CookieValue绑定请求中的Cookie值

1.概述

  @CookieValue可让处理方法入参,绑定某个Cookie值;

2.代码测试

<a href="springmvc/testCookieValue">testCookieValue</a>



@RequestMapping("/testCookieValue")
    public String testCookieValue(@CookieValue("JSESSIONID")String sessionid){
        //Cookie:JSESSIONID=891E99BCA3935B7A24842A1C04A3594B
        System.out.println("SpringMVCTest.testCookieValue()"+sessionid);
        return SUCCESS;
    }
    


结果:SpringMVCTest.testCookieValue()67F2AFA2D22E9B256B161EE0979E0344

猜你喜欢

转载自www.cnblogs.com/yikuan-919/p/9727297.html
今日推荐