How to Create an Update Page in Oracle Application Framework (OAF)
Introduction
An Update Page in Oracle Application Framework (OAF) allows users to modify existing records in the database. Unlike a data entry page (which inserts new records), an update page retrieves existing data, displays it for editing, and saves the changes back to the database.
This guide builds on the Search Page created in a previous tutorial. The typical flow is:
Search Page: User searches for records and views results in a table
Update Page: User clicks an update icon to open a page pre-populated with the selected record's data
Modify and Save: User edits the fields and clicks Update to save changes
Prerequisite Reading: Creating a Search Page in OAF — http://rpforacle.blogspot.com/2013/03/creating-search-page-in-oaf.html
Prerequisites
Before proceeding, ensure the following are complete:
Workspace and project RohitSearchPage created
Search Page (RohitSearchPagePG) created and functional
View Object SupplierVO created
Application Module RohitSearchPageAM created with SupplierVO attached
Controller RohitSearchPageCO created for the search page
Important: The update page uses the same Application Module as the search page. This allows the update page to access the row currently selected in the search results.
Step 1: Create the Update Page
Open the New Gallery:
Right-click on the project RohitSearchPage
Select New
Select Page:
Navigate to Web Tier → JSF/Faces (or Web Tier → Oracle ADF Faces)
Select Page
Click OK
Configure the Page:
Page Name:
RohitUpdatePGDefault Package:
rohit.oracle.apps.fnd.RohitSearchPage.webui
Note: Pages are always created under the webui directory of the project, following OAF standards.
Complete the Page Creation:
Click OK to create the page
Step 2: Configure the PageLayoutRN Region
Rename the Default Region:
In the Structure pane, click on region1
In the Property Inspector, change the ID to PageLayoutRN
Attach the Application Module:
With PageLayoutRN selected, locate the AM Definition property
Set it to:
rohit.oracle.apps.fnd.RohitSearchPage.server.RohitSearchPageAM
Set Page Properties:
Window Title:
Rohit TutorialTitle:
Update Page
Important: The update page uses the same Application Module as the search page. This is essential because the AM holds the currently selected row from the search results. When the update page opens, it can access that row and display its data.
Step 3: Create the Main Region
Create a New Region:
Right-click on PageLayoutRN
Select New → Region
A new region (region1) is created
Configure the Region:
In the Property Inspector, set:
ID:
MainRNRegion Style:
messageComponentLayout
Note: The
messageComponentLayoutregion style is commonly used for form-based layouts, arranging items in a structured, label-field format.
Step 4: Create the Data Entry Items
Now we create text input items bound to the View Object attributes for editing.
Create Item1:
Right-click on MainRN
Select New → messageTextInput
An item (item1) is created
Configure Item1:
| Property | Value |
|---|---|
| View Instance | SupplierVO |
| Item Style | messageTextInput |
| View Attribute | SupplierId |
| Prompt | Supplier No. |
Create Item2:
Repeat the process to create a second item (item2)
Configure Item2:
| Property | Value |
|---|---|
| View Instance | SupplierVO |
| Item Style | messageTextInput |
| View Attribute | SupplierName |
| Prompt | Supplier Name |
Note: These items are bound to the SupplierVO attributes. When the update page opens with a selected row, these fields are automatically populated with the current values, ready for editing.
Step 5: Create the Button Bar Region
Create a New Region:
Right-click on PageLayoutRN
Select New → Region
A new region (region1) is created
Configure the Region:
In the Property Inspector, set:
ID:
ButtonPageRegion Style:
pageButtonBar
Note: The
pageButtonBarregion style automatically positions buttons at the top and bottom right of the page, following Oracle's standard UI conventions.
Step 6: Create the Update and Cancel Buttons
Create the Update Button:
Right-click on ButtonPage
Select New → Item
An item (item3) is created
Configure the Update Button:
| Property | Value |
|---|---|
| Item Style | submitButton |
| Prompt | Update |
Create the Cancel Button:
Repeat the process to create a second item (item4)
Configure the Cancel Button:
| Property | Value |
|---|---|
| Item Style | submitButton |
| Prompt | Cancel |
Step 7: Create the Update Page Controller
Create the Controller:
Under the page RohitUpdatePG, right-click on PageLayoutRN
Select Set New Controller
Configure the Controller:
Controller Name:
RohitUpdatePageCOPackage:
rohit.oracle.apps.fnd.RohitSearchPage.webui
Note: Controllers are always created under the webui directory of the project, following OAF standards.
Step 8: Add an Update Icon to the Search Page Results
Now we need to add an update icon to the search page results table so users can click it to open the update page.
Open the Search Page:
In the Application Navigator, open RohitSearchPagePG
Create a New Item in the Results Table:
In the Structure pane, right-click on ResultsTable (under MainRN)
Select New → Item
An item (item1) is created under ResultsTable
Configure the Update Icon:
| Property | Value |
|---|---|
| ID | Update |
| Item Style | image |
| Prompt | Update |
| Image URI | updateicon_enabled.gif |
| Action Type | fireAction |
| Event | update_action |
Explanation: This creates a clickable update icon in each row of the search results. When clicked, it fires the
update_actionevent, which we will handle in the controller to navigate to the update page.
Step 9: Write the Controller Code
9.1 Code in RohitSearchPageCO (Process Form Request)
Add the following code to handle the update_action event and navigate to the update page:
if ("update_action".equals(pageContext.getParameter(EVENT_PARAM))) { pageContext.setForwardURL( "OA.jsp?page=/rohit/oracle/apps/fnd/RohitSearchPage/webui/RohitUpdatePG", null, OAWebBeanConstants.KEEP_MENU_CONTEXT, null, null, true, OAWebBeanConstants.ADD_BREAD_CRUMB_NO, OAWebBeanConstants.IGNORE_MESSAGES); }
Explanation: When the user clicks the update icon, this code forwards the user to the update page (
RohitUpdatePG). TheKEEP_MENU_CONTEXTconstant ensures the menu context is preserved, andADD_BREAD_CRUMB_NOprevents adding a breadcrumb.
9.2 Code in RohitUpdatePageCO (Process Form Request)
Add the following code to handle the Update and Cancel button clicks:
OAApplicationModule am = (OAApplicationModule)pageContext.getApplicationModule(webBean); if (pageContext.getParameter("item3") != null) { am.invokeMethod("apply"); } if (pageContext.getParameter("item4") != null) { am.invokeMethod("cancel"); }
Explanation:
item3 (Update): When clicked, invokes the
applymethod on the Application Module, which commits the changes to the databaseitem4 (Cancel): When clicked, invokes the
cancelmethod, which discards the changes and returns to the search page
Note: In a complete implementation, you would also need to add the
applyandcancelmethods to the Application Module implementation class (RohitSearchPageAMImpl.java).
Step 10: Rebuild and Run the Project
Rebuild the Project:
Right-click on the project RohitSearchPage
Select Rebuild
Note: Rebuilding compiles all Java classes and ensures there are no errors before deployment.
Run the Search Page:
After successful compilation, right-click on RohitSearchPagePG
Select Run
Test the Update Flow:
The search page opens in your browser
Enter search criteria and click Go to retrieve records
Click the Update icon next to a record
The update page opens with the record's data pre-populated
Modify the fields and click Update to save changes
Or click Cancel to discard changes and return to the search page
How the Update Page Works at Runtime
The following illustrates the complete flow:
┌─────────────────────────────────────────────────────────────────┐
│ SEARCH PAGE │
│ 1. User enters search criteria and clicks Go │
│ 2. Results displayed in table with Update icons │
│ 3. User clicks Update icon on a specific row │
└─────────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────┐
│ CONTROLLER (RohitSearchPageCO) │
│ 1. Detects "update_action" event │
│ 2. Forwards to RohitUpdatePG │
└─────────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────┐
│ UPDATE PAGE │
│ 1. Same AM (RohitSearchPageAM) provides the selected row │
│ 2. Fields populated with current values │
│ 3. User modifies data │
│ 4. User clicks Update or Cancel │
└─────────────────────────────────────────────────────────────────┘
│
┌───────────────┴───────────────┐
▼ ▼
┌─────────────────────────┐ ┌─────────────────────────┐
│ UPDATE CLICKED │ │ CANCEL CLICKED │
│ apply() invoked │ │ cancel() invoked │
│ Changes committed │ │ Changes discarded │
│ to database │ │ Return to search page │
└─────────────────────────┘ └─────────────────────────┘Understanding the Update Page Architecture
| Component | Role | Relationship |
|---|---|---|
| Search Page | Displays results with update icons | Source of the selected row |
| Update Page | Displays selected row for editing | Uses the same AM as search page |
| Application Module | Holds the selected row and manages transaction | Shared between both pages |
| Search Page Controller | Handles update icon click and navigation | Forwards to update page |
| Update Page Controller | Handles Update and Cancel button clicks | Invokes AM methods |
Why Share the Application Module?
The key architectural decision in this design is that both the search page and the update page use the same Application Module. This is intentional and important because:
The search page's AM holds the current row (the record the user selected)
When the update page opens, it accesses the same AM and therefore the same row
The update page's fields are automatically populated with the selected row's data
When the user clicks Update, the changes are applied to the same row in the AM and committed
Alternative Approach: In some implementations, a separate AM is used for the update page, and the row is passed via parameters or session storage. However, sharing the AM is simpler and more common for this pattern.
Best Practices
| Practice | Description |
|---|---|
| Share the AM | Use the same AM for search and update pages |
| Use Image Icons | Use standard Oracle icons (e.g., updateicon_enabled.gif) |
| Provide Cancel | Always provide a Cancel button to discard changes |
| Handle Validation | Add validation before applying changes |
| Confirm Updates | Display a confirmation message after successful update |
| Handle Errors | Add exception handling for database errors |
| Test Edge Cases | Test with no row selected, invalid data, etc. |
Troubleshooting Common Issues
| Issue | Possible Cause | Solution |
|---|---|---|
| Update page shows empty fields | AM not shared | Verify both pages use RohitSearchPageAM |
| Update icon doesn't work | Wrong event name | Verify the event matches in item and controller |
| Changes not saved | apply method not implemented | Add the apply method to AM implementation |
| Navigation fails | Wrong page path | Verify the path in setForwardURL |
| Cancel doesn't work | cancel method not implemented | Add the cancel method to AM implementation |
| Compilation errors | Missing imports | Add imports for OAWebBeanConstants, etc. |
Required Import Statements
import oracle.apps.fnd.framework.OAApplicationModule; import oracle.apps.fnd.framework.webui.OAPageContext; import oracle.apps.fnd.framework.webui.OAControllerImpl; import oracle.apps.fnd.framework.webui.OAWebBeanConstants; import oracle.apps.fnd.framework.webui.beans.OAWebBean;
Summary
Creating an update page in OAF involves the following key steps:
Create the Update Page: A new page with its own PageLayoutRN
Share the Application Module: Attach the same AM used by the search page
Create the Main Region: A
messageComponentLayoutregion for form fieldsCreate Data Entry Items: Bind items to View Object attributes
Create the Button Bar: Add Update and Cancel buttons
Create the Update Controller: Handle button clicks
Add Update Icon to Search Page: Create an image item with
fireActionWrite Navigation Code: Forward to the update page on icon click
Write Update/Cancel Code: Invoke
applyandcancelmethodsRebuild and Test: Compile and verify the complete flow
The key insight of this pattern is that the Application Module is shared between the search page and the update page. This allows the update page to automatically access the row selected on the search page, pre-populating the form fields with current values. When the user saves, the changes are applied to that same row and committed to the database.
This search-then-update pattern is one of the most common and important design patterns in Oracle E-Business Suite development, used extensively throughout standard Oracle Applications and custom extensions.
References
Prerequisite: Creating a Search Page in OAF — http://rpforacle.blogspot.com/2013/03/creating-search-page-in-oaf.html
Oracle E-Business Suite Documentation: OA Framework Developer's Guide
Oracle JDeveloper Documentation: Available in the
jdevdocfolderRelated Guides: Creating a Data Entry Page in OAF, Creating an LOV in OAF, Creating a Pop List in OAF, OAF Region Styles
No comments:
Post a Comment