Chapter 4. Managing server-side state

Table of Contents

Understanding servlet state
Engine
Visit object
Global object
Persistent page properties
Implementing persistent page properties manually
Manual persistent component properties
Stateless applications

Server-side state is any information that exists on the server, and persists between requests. This can be anything from a single flag all the way up to a large database result set. In a typical application, server-side state is the identity of the user (once the user logs in) and, perhaps, a few important domain objects (or, at the very least, primary keys for those objects).

In an ordinary servlet application, managing server-side state is entirely the application's responsibility. The Servlet API provides just the HttpSession, which acts like a Map, relating keys to arbitrary objects. It is the application's responsibility to obtain values from the session, and to update values into the session when they change.

Tapestry takes a different tack; it defines server-side state in terms of the Engine, the Visit object, and persistent page properties.