The Java EE 6 - Using Scopes

Using Scopes

For a web application to use a bean that injects another bean class, the bean needs to be able to hold state over the duration of the user’s interaction with the application. The way to define this state is to give the bean a scope. You can give an object any of the scopes described in following table, depending on how you are using it.

A user’s interaction with a web application in a single HTTP request.
A user’s interaction with a web application across multiple HTTP requests.
Shared state across all users’ interactions with a web application.
The default scope if none is specified; it means that an object exists to serve exactly one client (bean) and has the same lifecycle as that client (bean).
A user’s interaction with a JavaServer Faces application, within explicit developer-controlled boundaries that extend the scope across multiple invocations of the JavaServer Faces lifecycle. All long-running conversations are scoped to a particular HTTP servlet session and may not cross session boundaries.
The first three scopes are defined by both JSR 299 and the JavaServer Faces API. The last two are defined by JSR 299.

0 Respostas em "The Java EE 6 - Using Scopes"

Powered by Blogger