previous | start | next

## JavaBeans Components

- To use a bean in a JSF page, define it in `faces-config.xml`

      <managed-bean>
         <managed-bean-name>user</managed-bean-name>
         <managed-bean-class>bigjava.UserBean</managed-bean-class>
         <managed-bean-scope>session</managed-bean-scope>
      </managed-bean>

- Called a managed bean because the JSF container manages its lifetime
- Session scope: the bean is available for multiple requests by the same browser
- Application scope: the bean stays alive for the entire web application
  - It is shared among different users

previous | start | next