Showing posts with label ADF Study Notes. Show all posts
Showing posts with label ADF Study Notes. Show all posts

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."

Monday, 7 March 2011

ADF View Criteria vs. EJB Named Queries

The article quoted below presents one implementation of displaying the result of a complex query by using JPA Named Queries. As an exercise, as I am now studying ADF "View Criteria", I shall try to achieve the same result by using ADF-BC.

"Displaying Employee (HR schema) records in Hierarchical Tree can be achieved in ADF-BC by creating custom VO and a Viewlink for displaying root node.This can be more easily done using  EJB-DC by just introducing a NamedQuery to get the root node."
Display root node of Hierarchical Tree using ADF - EJB DC