Configuring a Faces detail page to use with an SDO

This task is the third of four in a demonstration on how to create a multi-page SDO application. In this task you create and configure the detail page to work with the master page and the multiple-use SDO. It assumes you have completed:

  1. Create a Faces JSP that will be used to access a multiple-use SDO. If you are working with the DB2® V8.2 SAMPLE database and have completed the previous tasks, open the createEmployee.jsp.
  2. In the Data drawer of the palette, drag a Relational Record to the page. The Add Relational Record wizard opens.
  3. Enter a name for the record, for example, employee.

  4. Select the Retrieve an existing record or record list from scope button and leave the Reuse metadata definition from an existing record or record list checked.
  5. Click on the Browse button next to the Input file field, and select the SDO metadata file created earlier, for example, department.xml:
    Add Relational Record Screen Capture
  6. For the "Create controls for" options, select Updating an existing record, then click Next.
  7. Select the appropriate table node, for example, DEPARTMENT_EMPLOYEE, then click Finish.
  8. Verify that the Page Data view shows the relational record for the table and that a form is generated on the page with the appropriate fields and controls. For example, using the SAMPLE database you should see the employee (EMPLOYEE) relational record in teh page Data view and a form on the createEmployee.jsp containing the Empno, Firstnme, Mininit, and Lastname fields as well as Submit and Delete command buttons.
  9. Drag a Link - Command next to the Delete button.
  10. Click on link label.
  11. In the Properties view, click h:outputText beneath h:commandLink and change the Value field to a name appropriate for the action, for example, Update, then press Enter.
  12. Select h:commandLink, then click the Quick Edit view icon next to "Click to code the action this link performs."
  13. In the left column, click Command.
  14. Right-click in the script editing area and select Insert Snippet > Create SubRecord. The Create SubRecord window opens.
  15. Select the appropriate record or record list, then select the node representing the table that should be updated, for example, employee (EMPLOYEE).
  16. Enter a variable name, for example, employee.
  17. Select Session from the Variable Scope list, then click OK. If you are working with the DB2 V8.2 SAMPLE database, verify that the following code is added to the Quick Edit view:
    ///actionBegin: wdo.createsub.record
    DataObject employeeParent = getRootDataObject(getEmployee());
    DataObject employee = getRootDataObject(getEmployee()).createDataObject("EMPLOYEE");
    employeeParent.getList("DEPARTMENT").add(employee);
    getSessionScope().put("employee", employee);
    //actionEnd: wdo.createsub.record
  18. Return to the h:commandLink tab of the Properties view, then click Add rule.
  19. Add a navigation rule so that the Link - Command action goes to another JSP, for example createEmployee.jsp.
    Note: For information on creating navigation rules, refer to Using navigation rules with Faces JSP pages
  20. Save the JSP.
To continue creating a multi-page SDO application, follow this step:

Feedback