标签:
通过使用@RequestHeader获取请求头
通过使用@CookieValue获取cookie值
代码:
1: @Controller
2: public class TestHeader_Cookie {3: @RequestMapping("/testHeader_Cookie")4: public String testRequestHeader(@RequestHeader("Accept-Language") String header,5: @RequestHeader("Cookie") String cookies,6: @CookieValue("JSESSIONID") String cookie) {7: System.out.println("header: " + header);8: System.out.println("cookies: " + cookies);9: System.out.println("cookie: " + cookie);10: return "success";11: }
12: }
URL:
1: <a href="testHeader_Cookie">testHeader_Cookie</a>
SpringMVC(五)@RequestHeader和@CookieValue
标签:
原文地址:http://www.cnblogs.com/FFFFF/p/4626820.html