tell me more icon Automatic Component Binding

Automatic component binding for a page can be turned on at initial page creation time. In the Create JSF Page dialog, expand Page Implementation, then select the automatic binding option that uses a new managed bean or an existing managed bean. The option to bind to an existing managed bean is enabled only if the application has a managed bean already configured.

Page Implementation options in Create JSF Page

If you did not turn on automatic component binding at initial page creation time, at page design time you can use the Desi gn then choose Page Properties menu to select Auto Bind in the Page Properties dialog, and then select an existing managed bean or create a new managed bean for the page (which you will do in the next step).

Page Properties dialog

To reiterate, when you enable automatic component binding, JDeveloper automatically creates a backing bean for the JSF page, if one does not yet already exist for the page. A backing bean is a JSF managed bean that contains logic and properties for UI components on a page. A managed bean is a JavaBean whose instantiation and scope you declaratively set up in the faces-config.xml file. More details about managed beans are described in another Tell Me topic.

A backing bean is used to hold:

  • properties that "back" the values in the UI components on the page
  • action methods that handle events for UI components on the page
  • instances of UIComponents from the page's UIComponent tree so that you can programmatically manipulate the user interface (for example, show/hide components)

When you insert a UI component on a page that uses automatic component binding, JDeveloper does the following:

  • In the backing bean, inserts a bean property and accessor methods for the component. For example:
    private HtmlInputText inputText1;
    public void setInputText1(HtmlInputText inputText1) {
      this.inputText1 = inputText1;
    public HtmlInputText getInputText1() {
      return inputText1;
  • In the page, uses the binding attribute on the component to bind the component instance to the bean property. For example: <h:inputText binding="#{backing_start.inputText1}" id="inputText1"/>, where backing_start is the bean name.

    Note: In the Property Inspector for a component that is automatically bound by JDeveloper, the Binding property field will not be available for editing.

JDeveloper does not create managed properties for any of the properties on the backing bean. Managed properties are any properties of the bean that you would like populated with a value when the bean is instantiated. If you wish the bean to be instantiated with certain property values, you must add the managed properties configuration entries in the faces-config.xml file manually.

Regardless of whether you enabled automatic component binding at page creation time or design time, at any time during page design you can turn off or turn on automatic component binding by using the Desi gn then choose Page Properties menu to deselect or select the Auto Bind checkbox. For example, if you want JDeveloper to automatically generate properties and accessor methods for some components you are adding to a page, turn on automatic component binding just before adding the components, then turn it off after you're done adding.

In the XML source code for a page that uses automatic component binding, JDeveloper inserts an auto binding comment line at the bottom of the file. For example:


In the next step of this cue card, you will continue with enabling automatic component binding by creating a new managed bean. After you complete the next step, you will see an auto binding comment line in the source code of the Start.jsp page.

Copyright © 1997, 2009, Oracle. All rights reserved.

false ,,,,,,,,,,,,,,,