Chapter 3. 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 request cycles. 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 a typical 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 and persistent page properties.