How to send a cookie in Servlet?
A cookie is a piece of information sent to a browser by a Web Server. The browser then returns that information to the Web server. This is how some Web pages "remember" your previous visits; for example, an E-Commerce site might use a cookie to remember which items you've placed in your online shopping cart. Cookies can also store user preference information, log-in data, etc.
Here is an example to send a cookie in the http response object to the client browser.