First page Back Continue Last page Graphics

More on Object Scope Life Cycles


Notes:

More on Object Scope Life Cycles

The managed-bean-scope element defines the scope in which the bean is stored. The four acceptable scopes are none, request, session, or application. If you define the bean with a none scope, the bean is instantiated anew each time it is referenced, and so it does not get saved in any scope. Use a none scope when a managed bean references another managed bean. The second bean should be in none scope if it is supposed to be created only when it is referenced.

A view state allocates a new view scope when it enters. This scope may be referenced within the view state to assign variables that should live for the duration of the state. This scope is useful to manipulate objects over a series of requests from the same view, often AJAX requests. A view state destroys its view scope when it exits.