Session 6 - Servlet | Cookie state management
| Type | Behaviour |
|---|---|
| Non-persistent | Valid for a single session only. Removed when the browser is closed.
Max age is -1. |
| Persistent | Valid across sessions. Survives closing the browser and is removed only on logout/signout. Max age is a positive number of seconds. |
| Step | URL | What it shows |
|---|---|---|
| 1 | CreateCookieServlet | Creates the cookies and adds them to the response. |
| 2 | GetCookieServlet | Reads the cookies back from the request and prints name, value and max age. |
| 3 | DeleteCookieServlet | Expires the cookies with setMaxAge(0). |
Steps 2 and 3 are POST-only, so reach them through the buttons on the pages rather than by clicking the links above - the form on the login page is the proper entry point.