jsf bean scopes

Bean Scopes:

When we define a bean, we have to define its scope also in which it will be placed. JSF implementation provide us serval scope for a bean. Request scope is the default scope.

Commonly used bean scopes:

1. Request scope.
2. View scope.
3. Session scope.
4. Application scope.

Request scope:

In request scope bean created when a request involving this bean comes and destroyed after completing response.

View scope:

In view scope bean created when a request involving this bean comes and destroyed when view changed.

Session Scope:

In session scope bean created when first request involving this bean comes and destroyed when session is terminated.

Application scope:

In application scope bean created when first request involving this bean comes and remains lives for whole duration of web application. An application scope managed bean is shared in all requests and sessions.
 

No comments: