Table of Contents
Previous Section
WOStateStorage { [size=numBytes
;] ... };
Description
A WOStateStorage element provides a simple mechanism for storing application state in an HTML page. If you include a WOStateStorage element in a form, any session and persistent data will be stored in the page rather than on the server.(For a detailed discussion of state management in WebObjects applications, see the chapter "Managing State" in the WebObjects Developer's Guide).
WOStateStorage uses HTML hidden fields ( <INPUT TYPE="HIDDEN"...>) to store state data. It will use as many hidden field as needed to store the data, but no field will be larger than the size specified by the size attribute. The default size setting is designed to work with most browsers.
Since WOStateStorage elements are implemented using hidden fields--which in HTML must be located within a form--they too must be located within a form. If a page has more than one form, you must declare a WOStateStorage element within each form.
An application that stores state in the page must consistently pass that state from page to page, maintaining an unbroken chain. Since state is stored in hidden fields, which must reside in forms, this implies that each page has a form that contains an embedded WOStateStorage element. For an example of a application that is designed to store its state in HTML pages, take a look at the DodgeLite example (after you've installed WebObjects).