Nov 7, 2018

Managed Bean Scopes in JSF

  1. Application (ApplicationScoped): Application scope persists across all users' interactions with a web application.
  2. Session (SessionScoped): Session scope persists across multiple HTTP requests in a web application.
  3. Flow (FlowScoped): Flow scope persists during a user's interaction with a specific flow of a web application. See Using Faces Flows for more information.
  4. Request (RequestScoped): Request scope persists during a single HTTP request in a web application.
  5. Dependent (Dependent): Indicates that the bean depends on some other bean.
  6. View (ViewScoped): The attributes persist until the user has navigated to the next view.
If your managed bean is referenced by the binding attribute of a component tag, you should define the bean with a request scope. If you placed the bean in session or application scope instead, the bean would need to take precautions to ensure thread safety, because javax.faces.component.UIComponent instances each depend on running inside of a single thread.