Inserting a URL to Pass Current Row Information to the ADF Binding Context

If your business services supports row currency on the data collection, you can use the exposed set-current-row operation on the collection in a URL link. For example, you may want to create a form with a display table in one web page and an input form in another web page. The URL link is used in the display table to pass the current row information to an ADF data action that displays the edit form for the specfied row.

Note: This same technique can be used to delete a data object in a collection. In fact, the operation performed on the current row is determined by the ADF data action that is the target of the link.

To create a table that displays a current row link:

  1. Open the Data Control Palette for the ADF-enabled web page that you want to design.

  2. In the Data Control Palette, select the desired data collection.

  3. To create the display table, select the collection node in the Data Control Palette that contains the attributes you want your table to display. Do not change the default selection Read-Only Table in the dropdown list.

  4. Insert the table into the existing HTML form. The design view of the Visual Editor should display the table and button inside the same dashed box, representing that they belong to the same HTML form element. The design view of your web page should look similar to this (not shown in its entirety):

    Display table.

  5. Now you can edit the table in the Visual Editor to add a column which will contain a link to pass the row key to the edit page. Click inside the table, right-click and choose Insert Column from the Tab le menu item.

  6. To specify the link, expand the selected collection and select:

    Then in the dropdown list, select Find Row Link .

  7. Add the link into the first column, in the second row (again dragging the selection from the top portion of the Data Control Palette into the field below the forEach statement). The design view of your web page should look similar to this (not shown in its entirety):

    Display table with extra column.

  8. To edit the link, right-click on the link and choose Edit Tag.

  9. Click OK to update the link in the table. The design view of your web page should look like this:

    Edit link in extra table column.

Handling the Current Row Event in a Struts Page Flow

If you are working with a Struts page flow and you used either setCurrentRowWithKey() or setCurrentRowWithKeyValue() to pass the row key, you must set the name of the page forward to match the event: accordingly, for example, either setCurrentRowWithKey or setCurrentRowWithKeyValue (or some other event name that you defined in the link definition). The page forward identifies the data action used to display the current row information. For example, you may want the action to display an edit web page to allow the user to edit the row data.

To handle the current row event with a separate edit page:

  1. Open the page flow diagram and insert a new data page ( /editPage), and draw a forward transition between the two.

    Page flow displays data pages.

  2. Name the page forward transition to match the name of the event you specified in the link for the web page you created.

    Page flow displays setCurrentRowWithKey.

    OR

    Page flow displays setCurrentRowWithKeyValue.

  3. Using the Data Control Palette, drop a setCurrentRowWithKey(string) or setCurrentRowWithKeyValue(string) operation for the same data collection on the new data page (editPage).

  4. Create the web page for the new data page (editPage) and drop the same data collection as an Input Form from the Data Control Palette.

  5. Return to the page flow and change the name of the forward transition to Submit to match the input form's Submit button event name.

    Page flow displays Submit transition.

About Model 1 Web Pages Event Handling

If you are working without Struts, in Model 1 web pages, it is necessary to subclass the oracle.adf.controller.lifecycle.PageLifeCycle , where you will handle the event like this:




public void onSetCurrentRowWithKey(LifecycleContext ctx) 

     { 

       super.invokeActionBinding(ctx, "setCurrentRowWithKey"); 

       try 

       { 

             ctx.setForwardPath("targetPage.jsp"); 

             ctx.setRedirect(true); 

       } 

       catch(Exception e) 

       { 

           e.printStackTrace(); 

       } 

     }    

Specifying a Bean Attribute as a Primary Key
Creating a Struts Page Flow For the Oracle ADF Application
Creating a Model 1 Style Web Page with Oracle ADF

 

Copyright © 1997, 2004, Oracle. All rights reserved.