Saving Client State
The Servlet API provides two ways to track client state:
Session tracking is a mechanism that servlets use to maintain
state about a series of requests from the same user (that is, requests
originating from the same browser) across some period of time.
Cookies are a mechanism that a servlet uses to have clients
hold a small amount of state-information associated with the user. Servlets
can use the information in a cookie as the user enters a site (as a low-security
user sign-on, for example), as the user navigates around a site (as a repository
of user preferences for example), or both.