Saturday, November 3, 2012

ADF: JSF- ADF Backing beans life cycle

Backing (also referred to as managed) beans are Java beans referenced by JSF pages in an ADF Fusion web application through Expression Language (EL). They are usually dedicated to providing specific functionality to the corresponding page.

They are part of the ViewController layer in the Model-View-Controller architecture. Depending on their persistence in memory throughout the lifetime of the application, managed beans are categorized based on their scope: from request (minimal persistence in memory for the specific user request only) to application (maximum persistence in memory for the duration of the application).

They can also exist in any of the session, view, pageFlow, and backingBean scopes.

Managed bean definitions can be added to any of the following ADF Fusion web application configuration files:
  • faces-config.xml:
    The JSF configuration file. It is searched first by the ADF framework for managed bean definitions. All scopes can be defined, except for view, backingBean, and pageFlow scopes, which are ADF-specifc.

  • adfc-config.xml:
    The unbounded task flow definition file. Managed beans of any scope may be defined in this file. It is searched after the faces-config.xml JSF configuration file.

  • Specific task flow definition file:
    In this file, the managed bean definitions are accessed only by the specific task flow.

Additionally, if you are using Facelets, you can register a backing bean using annotations.

Many times I see people called it Baking, it is "Backing not Baking".