Using the Client-Side Lifecycle

Using the JSF Lifecycle with ADF Faces 4-15 most respects, but if no subform on the page has an appropriate event come from its child components, then any subform with default set to true will behave as if one of its child components caused the submit. For more information about subforms, see Section 9.2, Defining Forms.

4.6 Object Scope Lifecycles

At runtime, you pass data to pages by storing the needed data in an object scope where the page can access it. The scope determines the lifespan of an object. Once you place an object in a scope, it can be accessed from the scope using an EL expression. For example, you might create a managed bean named foo, and define the bean to live in the Request scope. To access that bean, you would use the expression {requestScope.foo}. There are three types of scopes in a standard JSF application: ■ applicationScope: The object is available for the duration of the application. ■ sessionScope: The object is available for the duration of the session. ■ requestScope: The object is available for the duration between the time an HTTP request is sent until a response is sent back to the client. In addition to the standard JSF scopes, ADF Faces provides the following scopes: ■ pageFlowScope: The object is available as long as the user continues navigating from one page to another. If the user opens a new browser window and begins navigating, that series of windows will have its own pageFlowScope scope. ■ backingBeanScope: Used for managed beans for page fragments and declarative components only. The object is available for the duration between the time an HTTP request is sent until a response is sent back to the client. This scope is needed because there may be more than one page fragment or declarative component on a page, and to avoid collisions between values, any values must be kept in separate scope instances. Use backingBeanScope scope for any managed bean created for a page fragment or declarative component. ■ viewScope: The object is available until the ID for the current view changes. Use viewScope scope to hold values for a given page. Object scopes are analogous to global and local variable scopes in programming languages. The wider the scope, the higher the availability of an object. During their lifespan, these objects may expose certain interfaces, hold information, or pass variables and parameters to other objects. For example, a managed bean defined in sessionScope scope will be available for use during multiple page requests. However, a managed bean defined in requestScope scope will be available only for the duration of one page request. Figure 4–11 shows the time period in which each type of scope is valid, and its relationship with the page flow. Note: Because these are not standard JSF scopes, EL expressions must explicitly include the scope to reference the bean. For example, to reference the MyBean managed bean from the pageFlowScope scope, your expression would be {pageFlowScope.MyBean}. 4-16 Web User Interface Developers Guide for Oracle Application Development Framework Figure 4–11 Relationship Between Scopes and Page Flow When determining what scope to register a managed bean with or to store a value in, always try to use the narrowest scope possible. Use the sessionScope scope only for information that is relevant to the whole session, such as user or context information. Avoid using the sessionScope scope to pass values from one page to another.

4.7 Passing Values Between Pages

The ADF Faces pageFlowScope scope makes it easier to pass values from one page to another, thus enabling you to develop master-detail pages more easily. Values added to the pageFlowScope scope automatically continue to be available as the user Note: If you are using the full Fusion technology stack, then you have the option to register your managed beans in various configuration files. For more information, see the Using a Managed Bean in a Fusion Web Application section of the Oracle Fusion Middleware Fusion Developers Guide for Oracle Application Development Framework. Note: If you are using the full Fusion technology stack and you need information about passing values between pages in an ADF bounded task flow, or between ADF regions and pages, refer to the Getting Started With ADF Task Flows chapter of the Oracle Fusion Middleware Fusion Developers Guide for Oracle Application Development Framework.