Creating Cookies
Learn Creating Cookies (Cookies, Spring MVC) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.
Fresher Notes Cookie : a small name-value pair the server sends in a Set-Cookie response header; the browser stores it and returns it in the Cookie request header on later requests. Create one with new Cookie(name, value) and add it using response.addCookie(cookie) on the HttpServletResponse . Set the path with setPath("/") and a lifetime with setMaxAge ; without a max age it is a session cookie that dies when the browser closes.