Binding a Managed Bean to a Control

After you create a managed bean, you must bind the managed bean, or a method or property of the managed bean, to a component on a JavaServer Faces (JSF) Web page. A managed bean property provides data for the Web page, and a managed bean method binds logic to a component.

You can drag the following items from the Data Bindings view and drop them onto the Web Page editor.


The following procedure is specific to binding a managed bean property to a control. Binding the managed bean method, managed bean, or an existing bound managed bean name is similar, but the wizards are specific to the item you are working with and, therefore, vary.

To bind a managed bean property to a control:

  1. Select the .jsp Web page file that you with.
  2. In the Data Bindings view, Drag and drop the managed bean property or method onto the Web page. The Create JSF components wizard opens.
  3. To map the JSF components to the managed bean attributes:
    1. Unselect attributes that you do not want to map.
    2. Edit a JSF component by clicking in its cell, clicking the down arrow, and selecting a new component.
    3. Edit the text in the Label column to the appropriate name for each class member.
    4. To move an attribute up or down in the list, select the attribute and click Move Up or Move Down.
    5. Click:
      • Next to configure a container to hold the new components.
      • Finish to accept the defaults and skip the rest of this procedure.
  4. On the Create JSF Component for the ManagedBean Member page:
    Option Action
    Use a table-type container
    1. Select Use Table-Typed Container to Hold Components.
    2. Select either a JSF panelGrid or HTML table.
    3. Type the number of component pairs that you want to appear in each row.
    Use a non-table typed container Deselect Use table-typed container to hold components.
    The generated code from your selections is displayed.
  5. Click Finish. The Web page with your selections is generated.
  6. Select File > Save from the main menu bar.
Related concepts
Managed Bean Initialization
Related tasks
Configuring a Managed Bean
Changing Managed Bean Properties
Deleting a Managed Bean
Designing a Web Page
Creating a Web Page
Binding a Resource Bundle to a Web Page Component
Adding a Control to a Web Page
Defining Control Properties
Changing the Appearance of a Control
Adding an Object to a Web Page
Editing Object Properties
Linking Web Pages

Send your feedback on this help topic to Sybase Technical Publications: pubs@sybase.com

Your comments will be sent to the technical publications staff at Sybase, Inc. For product-related issues or technical support, contact Sybase Technical Support at 1-800-8SYBASE.