Skip Headers
Oracle® Application Development Framework Developer's Guide For Forms/4GL Developers
10g (10.1.3.1.0)

Part Number B25947-01
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
View PDF

21.6 Adding ADF Bindings to Actions

You can add ADF bindings to buttons or links. When you add a binding to a button or link, you use a method or operation from the data control. When a user clicks the button or link, the method or operation is invoked.

If you want the button or link to perform page navigation, after adding the ADF binding you must bind the action attribute of the component tag to a backing bean, which will handle the navigation. The backing bean must inject the ADF binding container and return an outcome value. For information about creating navigation rules and binding navigation components to backing beans, see Chapter 16, "Adding Page Navigation".

21.6.1 How to Add ADF Bindings to Actions

To add ADF bindings to a button or link, you drag a method or operation from the Data Control Palette and drop it on the button or link tag displayed in the Structure window. For general tips about dropping items from the Data Control Palette onto the Structure window, see Section 21.3.1, "How to Add ADF Bindings Using the Data Control Palette".

To add ADF bindings to a button or link:

  1. With the page displayed in the Design page of the visual editor, open the Structure window.

  2. In the Design page of the visual editor, select the button or link.

    The tag selected in the Structure window must be one of the tags listed previously in Table 21-1. JDeveloper simultaneously selects the corresponding tag in the Structure window. If the incorrect tag is selected, make the adjustment in the Structure window.

  3. From the Data Control Palette, drag a method or operation to the Structure window and drop it on the selected button or link tag.

  4. On the Data Control Palette context menu, choose Bind Existing CommandButton or Bind Existing CommandLink.

  5. If the method requires a parameter, the Action Binding Editor appears where you define the parameter values to pass to the method. (For more information about passing parameters to methods, see Chapter 17, "Creating More Complex Pages".)

21.6.2 What Happens When You Add ADF Bindings to an Action

Example 21-5 displays a command button before the ADF bindings are added.

Example 21-5 ADF Faces Command Button Before ADF Bindings

<af:commandButton text="Create User"/>

Example 21-6 displays the same button after the Create operation from the SRDemo data control was dropped on it. Since the original label was a static value, the binding replaced it with the name of the method; you can change the button label using the Property Inspector. An actionListener attribute was added with a binding on the Create operation. The actionListener detects when the user clicks the button and executes the operation as a result. If you want the button to navigate to another page, you can bind to a backing bean or add an action value. For more information, see Chapter 16, "Adding Page Navigation".

Example 21-6 ADF Faces Command Button After ADF Bindings Are Added

<af:commandButton text="Create"
                  actionListener="#{bindings.Create.execute}"
                  disabled="#{!bindings.Create.enabled}"/>

In addition to adding the bindings to the button, JDeveloper automatically adds an iterator and action binding object to the page definition file.

For more information about databound buttons and links, see Chapter 13, "Creating a Basic Page".