Avoiding the Blank Row Issue in ADF Business Components Web Applications
Oracle JDeveloper Tip
Avoiding the Blank Row Issue in
ADF Business Components Web Applications
Author: Steve Muench, ADF Development
Team Date: January 10, 2005
Using JDeveloper 9.0.5.2, Oracle ADF users lamented that when building a
basic browse-and-CRUD-style web application and performing steps like:
- From the browse page, click a button to create a
new record (which invoked the built-in ADF binding-layer
Create action)
- Without
submitting the "Create a New XXXX" page, the user changes
their mind and presses the browser back button to return to the browse page (or
alternatively clicks a link to return to that browse
page).
they would end up with a
(typically undesireable) "blank row" in the browse screen. In JDeveloper
10.1.2, we've introduced a new feature for ADF Business Components-based
applications that allows you to avoid the blank row in this case. ADF
applications using other business service layer technologies do not benefit
from this enhancement.
This issue was caused in 9.0.5.2 by the
fact that the built-in Create action actually was performing
both a createRow() and an insertRow()
operation, leaving the newly created row in the rowset. We've kept this
behavior as is for 10.1.2 so that behavior of existing applications is not
changed when migrating to 10.1.2, but for additional clarity we've changed the
label that appears in the design time Action Binding
Editor to be "CreateInsert" in 10.1.2 to better reflect what
this built-in action is doing. The action binding id code that appears in the
UIModel.xml file stays the same. It's just now called
CreateInsert in the design time instead of just
Create.
Why did we rename the 9.0.5.2 Create built-in action
to CreateInsert you ask? So that we could repurpose the name
Create for a new built-in action (with
newly introduced action id) in 10.1.2 that only performs the
createRow, but not the
insertRow. In the JDeveloper 10.1.2 release, applications
based on ADF Business Components use this new
Create(-but-don't-immediately-Insert)
action to avoid the "blank row" issue.
When using the new
Create action that does not perform the insert immediately,
the ADF Business Components runtime has been enhanced in 10.1.2 to insert the
row into the rowset in a delayed fashion when it is subsequently posted-back
for the first time instead. If the row is never submitted, it will just get
garbaged collected later and is never added to any rowset. This avoids the
blank row issue users experienced in 9.0.5.2. Once the initialized row is
submitted and is added to the rowset, as was the case in 9.0.5.2 with the
"Create-and-Insert-immediately" behavior, the developer needs to explicitly
remove the row if the user decides that they don't want it anymore.
In JDeveloper 10.1.2:
-
For
newly developed pages, when you drop a "Create" action
from the Data Control Palette for a datasource based on an ADF view object, the
design time will automatically create a "Create" action binding in the current
page's UI Model that is bound to the new built-in Create
action (which does not insert the blank row immediately).
If you
want to retain the CreateInsert-style
behavior — which would be required if you are implementing a UI in which you
perform in-line editing in the context of a table display, for example — then
see the
What's
New in 10.1.2 section of the JDeveloper 10.1.2 release notes for the
steps to follow to rebind your new "Create" action binding to use the
CreateInsert built-in action instead of the Create action
using the Action Binding Editor. The basic steps are:
- With your web page or struts page flow diagram open in the
editor, go to the UI model tab in the structure window.
- Edit the action binding named "Create" by
clicking on it in the UI Model tab and selecting
Edit... in the right-mouse context
menu.
- In the Action Binding
Editor, find the Select an Action dropdown list
and select the
CreateInsert action instead of the
Create action which is shown by
default.
-
After
opening your existing 9.0.5.2 applications in JDeveloper 10.1.2, if you want to
avoid the blank row issue by leveraging the new Create
action instead of the existing CreateInsert action, do the
following:
- With your web page or struts
page flow diagram open in the editor, go to the UI model tab in the structure
window.
- Edit the action binding named
"Create" (or whatever you've currently named it) by
clicking on it in the UI Model tab and selecting
Edit... in the right-mouse context
menu.
- In the Action Binding
Editor, find the Select an Action dropdown list
and select the
Create action instead of the
CreateInsert action which will be shown by
default.
|