First page Back Continue Last page Graphics

Object Scope Life Cycle


Notes:

Object Scope Life Cycle

Application scope is more dangerous than session scope and request scope. Objects placed in application scope can be used by more than one thread and must be designed accordingly. If an object is to be placed in application scope, the simplest design is to ensure that the object is immutable, such that external synchronization is never necessary.

A Session object is associated with a visitor. Data can be put in the session and retrieved from it, just as in a Hash table. A different set of data is kept for each visitor to the site.

Page flows provide an intermediate scope between the brief lifetime of a request and the potentially long lifetime of a session. A user may visit multiple page flows within the span of a single session, but as the user leaves each (non-nested) page flow the page flow’s resources are released.

Request scoped beans are created upon first access from the page. So if you have an inputText component on your JSP that stores a value in a request-scoped bean, the bean is first created (by calling the constructor), and then the setter method is called. After processing is done, the request scoped bean is destroyed.