Retaining Client and State Information

All but very simple Web applications are likely to require that information of some kind about the client be retained between different page requests. As has been stated, HTTP is stateless and does not provide a mechanism to ascertain that a series of requests have come from the same client.

There are a number of ways of retaining information about clients, such as hidden fields, cookies, and sessions (all described in this section). HTTP sessions are by far the simplest to use and are the recommended approach for Web Applications. Other techniques such as using HTTP cookies or hidden form fields belong to older, non servlet, technologies such as CGI scripts.

Using Session Objects

Sessions identify page ...

Get Sams Teach Yourself J2EE™ in 21 Days, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.