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:
Open the Data Control Palette for the ADF-enabled web page that you want to design.
In the Data Control Palette, select the desired data collection.
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.
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):
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.
To specify the link, expand the selected collection and select:
setCurrentRowWithKey(String) from its Operations folder. When passing the key, the URL for the form will not display the row key value. You may use this operation when the data collection defines a multipart attribute key.
OR
setCurrentRowWithKeyValue(String) from its Operations folder. Use this operation only when the data collection uses a single key attribute and does not define a multipart attribute key. When passing the key as a value, the URL for the form will display the row key value.
Then in the dropdown list, select Find Row Link .
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):
To edit the link, right-click on the link and choose Edit Tag.
When using setCurrentRowWithKey(string) , edit the tag as follows:
targetDataPage
.do?event=setCurrentRowWithKey&Arg0=<c:out
value='${Row.rowKeyStr}' />
for
URL
Edit
for Text
Specify the name of the target data action if necessary (will use the same name as the web page by default) and supply the text of the link.
When using setCurrentRowWithKeyValue(string) , edit the tag as follows:
targetDataPage
.do?event=setCurrentRowWithKeyValue&rowKeyStr=<c:out
value='${Row.KeyAttributeName}' />
for
URL
Edit
for Text
Specify the name of the target data action if necessary (will
use the same name as the web page by default), define the
event by the name "setCurrentRowWithKeyValue", specify the
name of the attribute which identifies the key value of the
collection (for example, Row.EmployeeNumber
for
the Employee collection), and finally supply the text of the
link.
Click OK to update the link in the table. The design view of your web page should look like this:
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:
Open the page flow diagram and insert a new data page (
/editPage
), and
draw a forward transition between the two.
Name the page forward transition to match the name of the event you specified in the link for the web page you created.
OR
Using the Data Control Palette, drop a setCurrentRowWithKey(string) or setCurrentRowWithKeyValue(string) operation for the same data collection on the new data page (editPage).
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.
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.
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.