Table of Contents Previous Section Application, Session, and Component Variables

Application, Session, and Component Variables

Where to create Lifetime Access in Component Script
Component variables The component window's object browser The component's lifetime myvar
Application variables Application tab of application window The application's lifetime self.application.myvar
Session variables Session tab of application window The session's lifetime self.session.myvar

When you create a variable in a component window, you are creating a component variable that's visible only inside that component. No other components can access it. A component variable lives only as long as the component that created it. If the component's page is deallocated, so is the component variable. If the page is redrawn after the component has been deallocated, the component variable is reinitialized.

To create a variable with a longer lifetime, create an application or session variable. An application variable's lifetime is the lifetime of the application. One instance of an application variable is created per application. That is, if three users are running sessions of the same application, they will share an instance of that application variable.

Session variables live as long as a session. An instance of a session variable is created for each session. If three users are running sessions of the same application, three instances of a session variable are created. If one user changes the value of that session variable, only that user sees the change. You can read more about application variables, session variables, and component variables in "Using WebScript" in the WebObjects Developer's Guide.


Table of Contents Next Section