Search Results


Tuesday, February 05, 2008

Managed Bean

Managed Bean

Managed beans are Java classes that you register with the. The managed beans are initialized when they are referenced in the application for the first time. It helps to handle UI events or write data manipulation code. TIP: Use managed beans to store only logic that is related to the UI rendering.

Managed beans can be registered in three files

  1. adfc-config.xml
  2. Task flow definition file
  3. faces-config.xml

adfc-config.xml

Managed bean declared in this file can be of any scope.

Task Flow definition file

Managed bean scope can any scope. However, managed beans of request, pageFlow, or with scope set to none accessed within the task flow definition, must be defined within the task flow definition file. Managed bean definitions within task flow definition files will only be visible to activities executing within the same task flow.

faces-config.xml

Allows any managed bean scope other than pageFlow scope.

The order of searching a managed bean in the application is faces-config.xml, adfc-config.xml and Task flow definition file (if exists). Hence managed bean defined in the faces-config.xml takes the precedence.

As a general rule in fusion web applications, a bean that may be used in more than one page or task flow is defined in the adbc-config.xml and a bean that is used within the task flow is defined in the task flow definition XML file.


Add a managed bean

To add a managed bean

  1. Click the adbc-config.xml file or task flow definition file.
  2. Go to Property editor -> Managed bean tab
  3. Choose the +(Add) Icon.



Difference between Managed Bean and Backing Bean

Backing bean and Managed bean are not different they are the same. Managed bean is about how the bean is created and initialized. Backing bean is about the role a particular managed bean plays.

In other way, Managed bean is a JavaBean registered in the adfc-config.xml file. These beans have properties that are bound to the values of UIComponents.

Backing bean is a special type of managed-bean consisting of properties that are UIComponents. Instead of the bean properties being bound to the UIComponent values, they are instead bound to the UIComponents themselves.


Post a Comment