First page Back Continue Last page Text

oracle adf workshop

Notes:


Using Managed Beans

The managed bean is defined in XML within the faces-config.xml file. This file exists in the WEB-INF directory of the application and is the master file for a JSF application. In a Fusion Web application, managed beans are more often configured in a task flow definition file, such as adfc-config.xml.

As you can see in the slide, the basic definition of a bean is simple: you provide an alias (in this case, userbean), the actual class to instantiate (here, com.oracle.sample.User), and the lifespan (here, request).

The ability to initialize the bean on creation follows the IoC design patterns, more specifically, the Setter Injection pattern. Using this pattern, an external process, JSF, is in control of configuring a bean by calling its setter methods. Note that Managed Beans in JSF use constructors with empty arguments.