Dialog Page in OAF

Introduction

In our Blog Exception in OAF, we have seen how to show message to user of any OAF Application, It’s via Exception. But still it doesn’t give the flexibility of clearing the data created recently and make a provision of creating another record easily. So to accomplish that we can implement Dialog Page which not only shows message to end user but asks User for an option whether to Create NewA�Employee Record or navigate to some page in maximum cases it is Employee Search Page. It’s possible through API:

oracle.apps.fnd.framework.webui.OADialogPage

Implementation

To continue with our project (all previous blogs should be followed sequentially), instead of throwing Exception to show message to confirm about success of record creation, we will implement Dialog Page. Let’s see how?

The following code snippet needs to be added after commit() method invocation in the processFormRequest() of the Controller Class:

// Implementation of Dialog Page

// Create the Exception
String confirmationMsg = “Employee is created Successfully !!!”;
OAException confirmMessageException = new OAException(confirmationMsg);

// Build the Dialog Page
OADialogPage dialogPage = new OADialogPage(OAException.INFORMATION,
confirmMessageException,
null,
“OA.jsp?page=/xxrd/oracle/apps/ap/webui/XXRDCreateEmpPG”,
“OA.jsp?page=/xxrd/oracle/apps/ap/webui/XXRDSearchEmpPG”
);

// set POST property for both Ok and No buttons of the Dialog Page
dialogPage.setOkButtonToPost(true);
dialogPage.setNoButtonToPost(true);

//set Label to Ok and No buttons of the Dialog Page
dialogPage.setOkButtonLabel(“Create New Employee”);
dialogPage.setNoButtonLabel(“Navigate to Search Page”);

//set ID to Ok and No buttons of the Dialog Page
dialogPage.setOkButtonItemName(“XXRD_NEW_EMP”);
dialogPage.setNoButtonItemName(“XXRD_SEARCHPG”);

// set the property for calling the Destination Pages from Dialog Page
dialogPage.setPostToCallingPage(true);

// Redirect to Dialog Page
pageContext.redirectToDialogPage(dialogPage);

To understand the code, the constructor being used here is:

OADialogPage(byte messageType, OAException descriptionMessage, OAException instructionMessage, String okButtonUrl, String noButtonUrl). The parameters are self-explanatory. Then POST property, Label, ID of both the Ok and No buttons are set sequentially. Having set the property for calling the Destination URLs (as given in the okButtonUrl, noButtonUrl) from Dialog Page is set to true and then the page will redirected to the Dialog Page usingA�redirectToDialogPage() method.

Now Run the page, output will be like:dialog_page_OAF

When the user clicks on Create New Employee (basically Ok button), the user will be navigated to Employee Creation Page. Else if user clicks on Navigate to Search Page (basically No button), then the user will be landed into the Employee Search Screen (Search Screen is not yet built in our project, will be implemented in our next blogs).

How to Redirect from One Page to Another Page

To let the user navigate to Search Page when user clicks onA�Navigate to Search Page button, the button event or redirection request will come to the processRequest() of the Controller class XXRDEmpCo of XXRDCreateEmpPG and in that method, we have to the logic to redirect the page to Search Page. Let’s take a look:

if(pageContext.getParameter(“XXRD_SEARCHPG”) != null)
{
pageContext.setForwardURL(“OA.jsp?page=/xxrd/oracle/apps/po/webui/XXRDSearchEmpPG”, // Page URL
null, //
OAWebBeanConstants.KEEP_MENU_CONTEXT, // Menu Context
null,
null, // parameters
false, // Retain AM true/false
OAWebBeanConstants.ADD_BREAD_CRUMB_NO, // to add Bread Crumb or not
OAWebBeanConstants.IGNORE_MESSAGES // whether to keep/ ignore messages
)
}

Redirection happens through method setForwardURL(), the method signature is:

void setForwardURL(StringA�url,
StringA�functionName,
byteA�menuContextAction,
StringA�menuName,
com.sun.java.util.collections.HashMapA�parameters,
booleanA�retainAM,
StringA�addBreadCrumb,
byteA�messagingLevel)

Here is the explanation of each of these parameters in Jdev Guide:

url – The URL to forward to. Example: OA.jsp?page=/oracle/apps/po/webui/myDestinationPG

menuContextAction – Determines the behavior of the MenuContext after forwarding to the new page.

parameters – HashMap of parameter name/value pairs to append to the forward URL.

retainAM – If true, all the cached application modules will be retained. If false, all the cached application modules will be released. Developers must use this parameter to control the release behavior of the cached appplication modules.

addBreadCrumb – Controls breadcrumbs behavior.document.

messagingLevel – Used to determine if the forward should be cancelled if messages or exceptions of level Error, Warning, Confirmation, or Information are found.

Page redirection can be done using many methods. I have discussed the same in detail in Page Redirection in OAF blog.

This is all about implementation of Dialog Page. I hope it has helped you to get an idea about this feature. In our next blog, we will learn about how to Implement Poplist in OAF.

Leave a Reply

Your email address will not be published. Required fields are marked *

Show my latest post here