An application component can be set to one of the following scopes:
Global: Component is shared among all users.
Session: Separate instances of the component are provided to each user.
Request: Separate instances of the component are provided to each active request.
Window: Separate instances of the component are provided to each browser window.
Prototype: Separate instances of the component are provided each time the component is resolved.
Specifying Component Scopes
You specify a component’s scope by setting its $scope
property to global
, session
, request
, or window
. For example, a NewPerson component might be set to session scope as follows:
$class=Person $scope=session name=Bill age=28
If a component’s $scope
property is not explicitly set, it automatically has global scope.
Property Object Scopes
A component’s properties should always point to objects whose scope is equal to or greater than its own. Thus, global-scope component properties should only point to objects that also have global scope; session-scope component properties should only point to objects that have global or session scope; while request-scope component properties can point to objects of any scope, including request.