What is a managed bean in JSF?
Answered
What is a managed bean in JSF?
Best answer
A managed bean is a lightweight container-managed object (POJO) that works as a model for UI component. A managed bean is created with a constructor with no arguments, a set of properties, and a set of methods that perform functions for a component. Managed beans typically perform the following function:
- Validating a component’s data
- Handling an event fired by a component
- Performing processing to determine the next page to which the application must navigate
Managed beans are created using @ManagedBean annotation or using managed-bean tag in faces-config.xml. For example, a Student managed bean can be written as follows: