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.
Managed bean property
The Create JSF components wizard opens to create a new JSF control with a property. Using this wizard, you can map the property to a JSF control and optionally define the layout of the generated controls.
There are particular types of properties that can be manipulated with the JSF datatable tag. There are specific wizards that open to assist you in mapping a property to a datatable. The types of properties that can be bound to a datatable include: List, ResultSet, Result and an array of value. See the JSF datatable tags definition for the complete details. Aside from some additional parameters required by the datatable tag, the properties and JSF Controls Mapping page are the same
Managed bean method
A method can be mapped to a commandLink or a commandButton action property. When you drag a method from Data Bindings and drop it onto the Web Page editor, you can create a new commandButton control.
Managed bean
A managed bean generates a set of controls with the properties of the managed bean.
An existing bound managed bean name (page variable)
After a managed bean is referenced in a Web page, you can use the bean’s handle to map its properties or method to other controls in the page within an appropriate scope. For example, if a loadbundle is declared in a page, you can map the bundle’s items to JSF controls in the page.
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 wizards will be specific to the item you are working with and, therefore, steps will vary.
To bind a managed bean property to a control:
Select the .jsp Web page file that you want to work with in the WorkSpace Navigator.
The Web page opens in the Web Page editor.
In the Data Bindings view, select the managed bean property or method that you want to use and drag and drop it onto the Web page.
The Create JSF components wizard opens.
To map the JSF components to the managed bean attributes:
Deselect attributes that you do not want to map.
Edit a JSF component by clicking in its cell, clicking the down arrow that appears, and selecting a new component.
Edit the text in the Label column to the appropriate name for each class member.
To move an attribute up or down in the list, select the attribute and click Move up or Move down.
Do one of the following:
Click Next to configure a container to hold the new components.
Click Finish to accept the defaults and skip the rest of this procedure.
On the Create JSF component for the ManagedBean member page, do one of the following:
To use a table-type container:
Select Use table-typed container to hold components.
Select either a JSF panelGrid or an HTML table.
Type the number of component pairs that you want to appear in each row in the text box.
To use a non-table typed container, unselect Use table-typed container to hold components.
The generated code from your selections is displayed.
Click Finish.
The Web page with your selections is generated.
Select File|Save from the main menu bar to save the Web page.
Building a Web Page Using a Managed Bean
Send your feedback on this help topic to Sybase Tech Pubs: pubs@sybase.com