A cookie is that test of piece which can be stored on the hard disk of a user by web server. Information is being stored on user machine by the help of cookies which is later retrieved. Such information pieces are stored as “name value pairs”. Cookie data gets moved in this way:
• If URL of a site is typed in the browser, browser will be sending its requests to web server. When this is done by the web browser cookie file is looked for at the machine which has been set by the URL.
Cookies are text files that are downloaded onto a visitor's hard drive to store the visitor's actions in order to better
customize their following visits. We may handle cookies in JSP and I will show you how to do that.
JSP provides an implicit response object which is used to add cookies. To add a cookie to the response, addCookie method is used.
We may store useful information in cookies for later use and this method is perfect for our needs. Java Code: response.addCookie(Cookie