Wednesday, June 22, 2016

Get Host Name and URL of OAF Page

This blog is about to get Host name and URL of OAF page. We will try to implement one button which will give host and URL of OAF page

1. Create a New OA Workspace and Empty OA Project
File> New > General> Workspace Configured for Oracle Applications
File Name -- HostandURL
Project Name – HostandURLProj
Default Package -- host.oracle.apps.fnd.hostandurl

2. Set Run Options in OA Project Setting
Select Your Project in the Navigator and choose Project Properties
Select Oracle Applications > Run Options
Select OADeveloperMode and OADiagnostic, and move them to selected Options List

3. Create Application Module AM
HostandURLProj right click > New > ADF Business Components > Application Module
Name -- HostandURLAM
Package -- host.oracle.apps.fnd.hostandurl.server
Check Generate JavaFile(s)

4. Create a OA components Page
HostandURLProj right click > New > OA Components > Page
Name -- HostandURLPG
Package -- host.oracle.apps.fnd.hostandurl.webui

5. Modify the Page Layout (Top-level) Region

Attribute
Property
ID
PageLayoutRN
Region Style
pageLayout
Form Property
True
Auto Footer
True
Window Title
Get Host and URL Window Title
Title
Get Host and URL Page Header
AM Definition
host.oracle.apps.fnd.hostandurl.server.HostandURLAM

6. Create the Second Region (Main Content Region)
Select PageLayoutRN right click > New > Region

Attribute
Property
ID
MainRN
Region Style
messageComponentLayout

7. Create a container Region for Go-Button
Select MainRN right click > New > messageLayout

Attribute
Property
Region
ButtonLayout

8. Create a Item (Go Button)
Select ButtonLayout > New > Item

Attribute
Property
ID
Go
Item Style
submitButton
Attribute Set
/oracle/apps/fnd/attributesets/Buttons/Go

9. Add a Controller
Select MainRN right click > Set New Controller
Package Name -- host.oracle.apps.fnd.hostandurl.webui
Class Name -- HostandURLCO

10. Edit Your Controller

Add Following Code in processFormRequest
import java.net.*;
import java.io.*;
import oracle.apps.fnd.framework.OAException;
import oracle.apps.fnd.framework.webui.OAPageContext;
public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
{
 super.processFormRequest(pageContext, webBean);
 if (pageContext.getParameter("Go") != null)
 {
  // To get Host Name
  try
  {
   InetAddress addr = InetAddress.getLocalHost();
     byte[ ] ipAddr = addr.getAddress();
     String hostname = "Host Name: " +addr.getHostName();
     pageContext.putDialogMessage(new OAException(hostname,
    OAException.WARNING));
  }
  catch (UnknownHostException e)
    {
    }
  // To Get Page URL
 
  String pageURL = "Current Page URL: " + pageContext.getCurrentUrl ();
 
  pageContext.putDialogMessage(new OAException(pageURL,
    OAException.WARNING));
 }


11. Congratulation you have successfully finished. Run Your page and Test Your Work
a

b


1 comment:

  1. 25% OFF on Oracle Apps R12 Financials Self Paced Course along with 11 Additional Add On Courses (321 Session Videos of 120 Hours Recordings). Our Top Trending Course with 1700 Enrolled Udemy Students

    Please Check https://www.oracleappstechnical.com for details

    ReplyDelete