Now, you will add a row action to the table on all_records.jsp
so the user can select a database record to update. #{param.ID} represents
the ID number of the record that the update page will update. When the user
clicks a row, that record ID number will be sent to the update_record.jsp
page as the #{param.ID} parameter. Then, the filtered
relational record you just inserted into the update_record.jsp page will display
only that record for updating.
- In the Enterprise Explorer view, double-click the all_records.jsp file
to open it in the Editor. Click anywhere inside the data table. Open the Properties
view.
- In the Properties view, click the Row Actions tab
under hx:dataTableEx from the list of HTML tags.
- Click Add an action that's performed when a row is clicked.
The Configure a RowAction dialog opens. Select Clicking the row
sends a request to the server with row information sent as parameters then
click OK. A column is added to the data table.
- In the Properties view, click the hx:requestRowAction tab.
- Click Add Rule. The Add Navigation Rule
dialog opens.
- From the Page drop down, select update_record.jsp.
In the This rule is used by box, select This action only.
The this action only field is automatically populated by #{pc_All_records.doRowAction1Action} which
was created when you added the row action. Click OK. If the field is not automatically populated with the above method, type
the method in the field and add the following to ClassifiedsTutorial/Java
Resources: src/pagecode/All_records.java:
public String doRowAction1Action() {
return "";
}
- In the Properties view, click the Parameter tab
under hx:requestRowAction. Click Add Parameter then
type ID in the Name field. You need to bind the ID
parameter to the ID column. Binding the row action to the ID column of the
data list means that when the row is clicked, the request parameter will be
the ID of the record in the list.
- Click Value then click the Select
Page Data Object
button.
- In the Data Object tab, expand and select ID (java.lang.Integer).
- Click OK.
Now when the user clicks a row, the Web site will allow the user to
update information about the classified ad. Save the file and test the page
if you would like. Remember to open all_records.jsp first, because this is
the page that links to update_record.jsp.