During Visual Web JSF development, when you bind a simple component to a database, you create a connection between the component and a column in a database table. Simple components display one value at a time. For easiest data binding, use components from the Basic category of the Palette, such as Button.
First, set up the component and database table in the IDE. Then, decide whether to drop the database table directly on the component or to drop the database table on the page and then bind the database table to the component. If you drop the database table directly on the component, the component is bound to the first value in the first column of the database table. To bind the component to another column, drop the component on the page and choose the column.
To set up the database table and component:To drag and drop the database table on the component:
For example, in the Services window, expand Databases > Travel > Tables and drag the TRIPTYPE table and drop it on a button. At runtime, the button displays the value in the first row in the first column of the table. In this example, the first value in the TRIPTYPEID column of the TRIPTYPE table is 1.
To drag and drop the database table on the page and then bind it to the component:
For example, in the Services window, open Databases > Travel > Tables and drag the TRIPTYPE table to the page. Then, select a button and choose Bind to Data. In the Bind to Data dialog box, select the triptypeDataProvider and the TRIPTYPE.NAME column and click OK. At runtime, the button displays TRNG, which is the value in the first row in the NAME column of the TRIPTYPE table.