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

All Categories

Call Fusion BIP Report2 Change Password1 Code Combinations2 Compute Instance2 CTE1 Customer1 Data Aggregation2 Database5 Date Conversion1 DB Adapter2 Decryption1 Development1 EBS4 Encryption1 ESS Jobs3 Examine1 FBDI3 Fusion APIs1 Fusion BIP7 GIT2 GL3 GL Journals1 GL_DAILY_CONVERSION_TYPES1 GL_DAILY_RATES1 ICS1 Identity Domain1 Integrations1 Java1 Journal Import1 Keys1 Legal Entity1 LookupTypeLOV1 LOV1 LOVs1 MultiPartAPIs1 Networking1 NVL2 NVL in OIC2 OCI11 OCI Billing1 OCI Compute5 OCI Cost Management1 OCI Events Service1 OCI Free Tier3 OCI Notifification Service1 OCI Security3 OIC4 OIC Mapper2 Oracle26 Oracle ADF17 Oracle APEX1 Oracle Apps59 Oracle Apps R126 Oracle ATP1 Oracle BIP8 Oracle Cloud12 Oracle Cloud Free Tier1 Oracle cloud Infrastructure9 Oracle Cloud Security2 Oracle Cloud VM1 Oracle DB4 oracle ebs5 Oracle ERP4 Oracle ERP Adapter2 Oracle ERP Cloud7 Oracle financials2 Oracle Forms1 Oracle Fusion57 Oracle Fusion BIP4 Oracle Fusion ERP17 Oracle Fusion Financials18 Oracle Integration Cloud3 Oracle OAF17 Oracle OCI14 Oracle OIC22 Oracle SOA 12c10 Oracle SQL17 Oracle VBCS1 Oracle VBS2 Oracle Visual Builder Cloud Service1 Oracle Visual Builder Studio2 Oracle Workflow Notifications1 Others10 Payables2 Payables Import1 Properties1 R121 Register BIP as ESS Job1 Reset Password1 Responsibility1 REST4 Security List1 Site Map1 SOAP2 SOAP API2 SOAP UI3 SQL16 SQL Functions3 SQL Queries14 SQL Query8 SQL Tips3 SSH1 TCA1 Value Sets1 VBCS1 Virtual Machine2 Virtual Machines1 XML1 XSLT1
Show more