What is a JSF managed bean

Difference between managed bean and backing bean

What is managed bean?

JavaBean objects managed by a JSF implementation are called managed beans. A managed bean describes how to create and manage a bean. It has nothing to do with the functionalities of the bean.

What is backing bean?

Backing beans are JavaBeans components that are assigned to the UI components used in a page. The backing bean management separates the definition of UI component objects from objects that perform application-specific processing and store data. The backing bean defines properties and handling logics that are assigned to the UI components used on the page. Each backing bean property is tied to either a component instance or its value. Backing Bean also defines a number of methods that perform functions on the component, such as: For example, reviewing the component data, handling events that the component raises, and performing navigation-related processing when the component is activated.

What are the differences between a backing bean and a managed bean?

Backing beans are just a convention, a subtype of JSF managed beans that have a very specific purpose. There is nothing special about a backing bean that sets it apart from any other managed bean other than how it is used.

MB : Managed Bean; BB : Backing Bean

1) BB : A backing bean is a bean referenced on a form.

MB : A managed bean is a backing bean that has been registered with JSF (in faces-config.xml) and automatically created (and optionally initialized) by JSF when needed.

The advantage of managed beans is that the JSF framework creates these beans automatically and optionally initializes them with the parameters specified in faces-config.xml.

2) BB : Backing beans should only be in scope request scope To be defined

MB : The managed beans created by JSF can be found in the area Request, session or application get saved.

Backing beans should be defined in the requirements section, have a one-to-one relationship with a particular page, and contain all of the page-related event handling code. In a real-world scenario, multiple pages behind the scenes may need to use the same background bean. A backing bean contains not only view data, but also behaviors related to that data.