Scope of managed bean is a very important aspect while developing
applications, so it is necessary to clearly understand memory scope of
managed bean-
Application Scope-
The application scope lasts until the application stops. Values that you
store in a managed bean with this scope are available to every session
and every request that uses the application.
Avoid using this scope in a task flow because it persists beyond the life span of the task flow.
Avoid using this scope in a task flow because it persists beyond the life span of the task flow.
Session Scope-
The session scope begins when a user first accesses a page in the
application and ends when the user's session times out due to
inactivity, or when the application invalidates the session.
Use this scope only for information that is relevant to the whole session, such as user or context information. Avoid using it to pass values from one task flow to another. Instead, use parameters to pass values between task flows. Using parameters gives your task flow a clear contract with other task flows that call it or are called by it. Another reason to avoid use of session scope is because it may persist beyond the life span of the task flow.
Use this scope only for information that is relevant to the whole session, such as user or context information. Avoid using it to pass values from one task flow to another. Instead, use parameters to pass values between task flows. Using parameters gives your task flow a clear contract with other task flows that call it or are called by it. Another reason to avoid use of session scope is because it may persist beyond the life span of the task flow.
Pageflow Scope-
Choose this scope if you want the managed bean to be accessible across
the activities within a task flow. A managed bean that has a pageFlow
scope shares state with pages from the task flow that access it. A
managed bean that has a pageFlow scope exists for the life span of the
task flow.If another task flow's page references the managed bean, the
managed bean creates a separate instance of this object and adds it to
the pageFlow scope of its task flow.
Request Scope-
Use request scope when the managed bean does not need to persist longer than the current request.
Backing Bean Scope-
A backing bean is a convention to describe a managed bean that stores
accessors for UI components and event handling code on a JSF page. It
exists for the duration of a request and should not be used to maintain
state.
Use this scope if it is possible that your task flow appears in two ADF regions on the same JSF page and you want to isolate each instance of ADF region.
Use this scope if it is possible that your task flow appears in two ADF regions on the same JSF page and you want to isolate each instance of ADF region.
No comments:
Post a Comment