Adding logic to the user interface
Logic in the user interface is implemented in the form of managed beans. These are Java classes that are registered with the task flow and automatically instantiated by the ADF framework. As you might remember from Chapter 3, Creating Task Flows and Pages, ADF operates with various memory scopes –– you have to decide on a scope when you define a managed bean.
Adding a bean method to a button
The simplest way to add logic to the user interface is to drop a button (af:commandButton
) onto a page or page fragment and then double-click on it. This brings up the Bind Action Property dialog as shown in the following screenshot:
If you leave Method Binding selected and click on New, the Create Managed Bean dialog appears as shown in the following screenshot:
In this dialog, you can give your bean a name, provide a class name (typically the same as the bean name), and select a scope. The backingBean
scope is a good scope for logic that is only used for one action when...