Friday 13 May 2011

Managed Beans and Backing Beans in Standard JavaServer Faces, Java EE and ADF Applications

A typical JavaServer Faces application includes one or more backing beans, each of which is a JavaServer Faces managed bean that is associated with the UI components used in a particular page.

The managed beans can be referenced in an EL expression, allowing access to the beans' properties and methods.

"Technically, a Managed Bean is a POJO that's constructed and injected by the JSF framework. It's commonly referenced by JSF pages, but it doesn't have to be. For example, it could be a Session-scope repository of data for other (non-page) resources to reference.

A Backing Bean is a bean that's referenced on JSF pages, and offhand I can't think of any way to establish that reference unless it's a ManagedBean.

So there's a difference, but for most people most of the time, it's small enough that the terms tend to get used interchangeably." (Tim Holloway, http://www.coderanch.com/t/214065/JSF/java/backing-beans-vs-managed-beans)

Managed Beans are new to the Java EE 6 platform, represent a generalization of the managed beans specified by JavaServer Faces technology and can be used anywhere in a Java EE application, not just in web modules. (http://download.oracle.com/javaee/6/tutorial/doc/bnacj.html#gjxsd)

 

Managed Beans in ADF

In a standard JSF application, managed beans are registered in the faces-config.xml configuration file. In a Fusion web application, managed beans can be registered in the faces-config.xml file, the adfc-config.xml file, or a task flow definition file.

Creating and Using Managed Beans in ADF


Deeper Study Path

"Expression Language in JavaServer Faces 1.2 does not support passing arguments to methods in a managed bean. Not a big deal though as you can pass the required information using memory attributes, managed bean properties of the ADF binding layer."

No comments: