During Visual Web JSF development, when you bind a Table component to a database, you create
a connection between the Table component and a database
table. After you bind, check the table layout as described below to ensure that the columns are displayed in the correct order.
Before binding a table component to a database, you must ensure that the Java DB Database Server is installed and running. To start the Java DB Database Server, in the Services window, choose Databases > Java DB > Start Server.
Each column of a table must have a unique name. If two or more tables contain columns with the same name, you must rename one of the columns to be able to use both database tables in a table component.
If you are not connected to the database, in the , connect now.
In the database-name node, expand the Tables node to see the tables in the database.
To drag and drop a database table onto the Table component:
Drag the database
table from the Services window to the Visual Designer and
drop the database
table onto the Table component.
If you try to drop the database
table onto a cell in the Table component instead of the Table component
itself, the Choose Target dialog box appears asking you to choose the target. Choose the
Table component and click OK.
The Table component reformats to show the same
columns as the database table. See "To check and adjust the table layout" below.
To bind a Table component to a database
table that has already been added to the page:
Select the entire Table component.
Right-click and choose Bind to Data.
In the Table Layout dialog box, choose the data provider to which
you want to bind the Table component and click OK.
When the dialog box closes, the Table component reformats to show the same
columns as the database table.
To check and adjust the table layout:
In the Visual Designer, right-click the border of the table
and choose Table Layout.
In the Table Layout dialog box, select columns from the Available list on the left side.
Move the columns to be displayed in your application to the Selected list by selecting each column and clicking the > button.
Move the columns that you do not want to display out of the Selected list by selecting each column and clicking the < button.
You can change the order of the columns by selecting a column and clicking Up or Down.
When the Selected list shows the columns in the desired order, click OK.
In the Visual Designer, you see the columns displayed in the Table component. Each column shows
the data for the database column it displays.