asked in JSP by (58.6k points)

1 Answer

Setting cookies with JSP involves three steps −

  • Creating a Cookie object − You call the Cookie constructor with a cookie name and a cookie value, both of which are strings.

  • Setting the maximum age − You use setMaxAge to specify how long (in seconds) the cookie should be valid.

  • Sending the Cookie into the HTTP response headers − You use response.addCookie to add cookies in the HTTP response header

answered by (58.6k points)

Java Interview Questions and Answers 2018

>
...