Monday, March 23, 2015

What are the different kinds of Bean Scopes in JSF?

ANS: JSF supports three Bean Scopes. viz.,
Request Scope: The request scope is short-lived. It starts when an HTTP request is submitted and ends when the response is sent back to the client.
Session Scope: The session scope persists from the time that a session is established until session termination.
Application Scope: The application scope persists for the entire duration of the web application. This scope is shared among all the requests and sessions.

Difference between Backing Bean and Managed Bean?

Backing BeansManaged Beans
A backing bean is any bean that is referenced by a form.A managed bean is a backing bean that has been registered with JSF (in faces-config.xml) and it automatically created (and optionally initialized) by JSF when it is needed.
The advantage of managed beans is that the JSF framework will automatically create these beans, optionally initialize them with parameters you specify in faces-config.xml,
Backing Beans should be defined only in the request scopeThe managed beans that are created by JSF can be stored within the request, session, or application scopes