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 -- prajkumar.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 -- prajkumar.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 -- prajkumar.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

prajkumar.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 -- prajkumar.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

 

 

Comments:

Post a Comment:
  • HTML Syntax: NOT allowed
About

Welcome to My Oracle World Puneet Rajkumar

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today