Displaying Exception in OAF page


Displaying Exception in OAF page


Now we are going to know how to populate the exception message when a button pressed.

Create one project.

Create one page.

Create one region in that create two items one messageTextInput and another submitButton.

Create one controller in the main region and write the code in the controller to display the exception message whenever we click the submit button.



After that u will get the window their give the controller name and in package by default u will get two webui just remove one.




Write the following code in the controller processFormRequest

/*For Copy Paste*/

  public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
  {
    super.processFormRequest(pageContext, webBean);
   
    //Handle the submit button
   
    if(pageContext.getParameter("Go")!=null)
    {
        //Capture the values of the item
       
        String s= "Hi "+pageContext.getParameter("item1");
        throw new OAException(s,OAException.INFORMATION);
    }
  }


For exception first we have to import the following package.

import oracle.apps.fnd.framework.OAException;

There is no need to write the import package explicitly while writing in code it will show one pop up for import at that time just press Alt+Enter.

In the above code throw is the reserve keyword for exception.

Item1 is the ID of the messageTextInput item.

Go is the id of the submit button.

Run the page to get the desired output.


1 comment: