02- Hello World page in OAF

Follow the below steps to create your first Hello World page in OAF. Before proceeding with these steps make sure you have setup your jDeveloper properly and created OAWorkspace. In case you have not done that before, click here to see how.

  • Right click the project name and click New


  • Under Web Tier category, select Page. This will create a new page(.xml) file:


  • Give the page name and package in which this page will be stored. Package you can considered as a directory, but we use dot(.) to name them. So, the page will be stored in /oracle/apps/cie/demo/helloworld directory under $JAVA_TOP 

We follow the below convention to name our packages in OAF:

oracle.apps.<application_short_name>.<component_name>.<sub_component_name>.<folder_as_per_below_table>

Sometimes we use below convention also:

<company_name>.oracle.apps.<application_short_name>.<component_name>.<sub_component_name>.<folder_as_per_below_table>

So, each file of OAF will be stored unde$JAVA_TOP   as per the above package locations, which must be under directory /oracle/apps or /<company_name>/oracle/apps :

Below are the naming conventions for your files and default folder locations for these files:



So, in our case (
oracle.apps.cie.demo.helloworld.webui)
cie is application name
demo is component name
helloworld is sub component name
webui is folder (since we are creating a page so as per the above table it must go in webui folder) 

  • You will now see that HelloWorldPG.xml has appeared in the application navigator and in the structure window you will see the structure of the file. In OAF, .xml files will be displayed in structure window. The file location will be displayed at the bottom. All OAF files will be present in JDEV_USER_HOME\myprojects 

But, you can open the file in any text editor:




  • In every OAF Page we have to set the below four properties of the pageLayout region. 
    • ID: Give some meaningful name like, PageLayoutRN (RN as suffix to identify that it's a region)
    • AM Definition: Application Module to be used. Each page must have AM Definition. If you don't have any AM created yet, you can use OAF standard AM:
                     oracle.apps.fnd.framework.server.OAApplicationModule
    • Window Title- This will be the tab name in browser window. Set it as Hello World Page
    • Title- This will be the title of the region. Set it as Welcome to my First Page



  • Click on region1 in structure and go to property inspector:



  • Now, right click the PageLayoutRN and select  New -> Region 

It is always advisable to create another region inside PageLayoutRN and then add the components   



  • In Property Inspector change the ID to MainRN and Region style to messageComponentLayout



  • Right click the MainRN and select New -> messageTextInput to add one messageTextInput field (textbox). 




  • Change ID to NameTxt and Prompt to Name 


  • As we cannot create button inside messageComponentLayout region, we will first create messageLayout and inside that we will add the button. So, right click MainRN and select New -> messageLayout


  • Once messageLayout is added, right click and select New -> Item 


Change ID to GoBtn Prompt to Go and Item Style to submitButton





  • Now right click PageLayoutRN and select Set New Controller


  • Give Package Name as oracle.apps.cie.demo.helloworld.webui and Class Name as HelloWorldCO (CO suffix to identify Controller File)


  • Controller java file will be created





  • Write the below highlighted code:
/*===========================================================================+
 |   Copyright (c) 2001, 2005 Oracle Corporation, Redwood Shores, CA, USA    |
 |                         All rights reserved.                              |
 +===========================================================================+
 |  HISTORY                                                                  |
 +===========================================================================*/
package oracle.apps.cie.demo.helloworld.webui;

import oracle.apps.fnd.common.VersionInfo;
import oracle.apps.fnd.framework.OAException;
import oracle.apps.fnd.framework.webui.OAControllerImpl;
import oracle.apps.fnd.framework.webui.OAPageContext;
import oracle.apps.fnd.framework.webui.beans.OAWebBean;

/**
 * Controller for ...
 */
public class HelloWorldCO extends OAControllerImpl {
    public static final String RCS_ID = "$Header$";
    public static final boolean RCS_ID_RECORDED = 
        VersionInfo.recordClassVersion(RCS_ID, "%packagename%");

    /**
     * Layout and page setup logic for a region.
     * @param pageContext the current OA page context
     * @param webBean the web bean corresponding to the region
     */
    public void processRequest(OAPageContext pageContext, OAWebBean webBean) {
        super.processRequest(pageContext, webBean);
    }

    /**
     * Procedure to handle form submissions for form elements in
     * a region.
     * @param pageContext the current OA page context
     * @param webBean the web bean corresponding to the region
     */
    public void processFormRequest(OAPageContext pageContext, 
                                   OAWebBean webBean) {
        super.processFormRequest(pageContext, webBean);
        try {
            if (pageContext.getParameter("GoBtn") != null) {
                String name = pageContext.getParameter("NameTxt");
                String message = "Hello " + name;
                pageContext.putDialogMessage(new OAException(message, 
                                                             OAException.INFORMATION));
            }

            System.out.println("Responsibility: " + 
                               pageContext.getResponsibilityName());
            System.out.println("User: " + 
                               pageContext.getUserName());

        } catch (Exception ex) {
            ex.printStackTrace();
        } finally {
        }

    }

}



  • processRequest is called on the page load
  • processFormRequest is called on every form action like when we click button. 
  • Whenever button is clicked then pageContext.getParameter("GoBtn"is initialised and we can write our code in that if block
  • Save All the files and right click HelloWorldPG and select Run






  • Below page will be displayed




  • Enter your name and click the Go button


  • Make sure that your host file does not contain any entry for local IP address 

Comments