beautypg.com

Objects and state, The application object and application state – Apple WebObjects 3.5 User Manual

Page 113

background image

Objects and State

113

Characteristically, WebObjects takes an object-oriented approach to
fulfilling any of these state-storage requirements.

Objects and State

Three classes manage state in an application—WOApplication,
WOSession, and WOComponent. (In Java, these classes are called
WebApplication, WebSession, and Component.) An application object
handles state associated with the application as a whole, session objects
handle state associated with a particular user session within the application,
and component objects handle state associated with a particular page or
component within a session.

The Application Object and Application State

The application object is the logical place to store data that needs to be
shared by all components in all sessions of an application. Application state
is typically stored in the application object’s instance variables. For
example, the application object in the DodgeLite example application (in

/WebObjects/Examples

where

is your web server’s document

root), keeps information about the cars available and the possible prices: