Beruflich Dokumente
Kultur Dokumente
Training Material
TABLE OF CONTENTS
PURPOSE OF THE DOCUMENT...............................................................................................4
DOCUMENT USAGE....................................................................................................................4
DETAILS OF DOCUMENT..........................................................................................................4
1
OAF ARCHITECTURE.........................................................................................................4
1.1
ABOUT MODEL....................................................................................................................5
1.2
ABOUT VIEW.......................................................................................................................5
1.3
ABOUT CONTROLLER..........................................................................................................5
2. KEY FEATURES........................................................................................................................6
2.1
INTEGRATED DEVELOPMENT ENVIRONMENT (IDE)............................................................6
2.2
DURABLE PERSONALIZATIONS AND EXTENSIONS...............................................................6
2.3
CONSISTENT AND COMPELLING USER INTERFACE..............................................................6
2.4
OBJECT ORIENTED REUSE...................................................................................................7
3. OA FRAMEWORK ESSENTIALS................................................................................................7
4. IMPLEMENT THE MODEL IN OAF..........................................................................................9
5.
IMPLEMENT THE VIEW IN OAF..........................................................................................11
6. IMPLEMENT THE CONTROLLER IN OAF...........................................................................12
7. OAF KEY DO'S AND DON'TS (PART 1) - "TOP 10" GOLDEN RULES.....................................13
8. PRACTICAL PROBLEMS AND SOLUTIONS...............................................................................20
Display the message as Welcome <text item value> on the OAF
page
when you press the Go button............................................................................................20
Product Branding:..........................................................................................................23
In-Context Branding:.....................................................................................................24
How do display default string in Text Item when page is rendered.................................26
How do hide Text item at runtime...................................................................................26
How do disable the button at runtime.............................................................................27
How do display message in different colour...................................................................27
How do call the specified page from another page.........................................................27
How do display the Return Navigation link on the page.................................................29
How do add a returnLink dynamically...........................................................................30
Connect to Database and return number of suppliers on the page.................................31
How do call stored procedure from OAF page (Without using EO, VO).........................32
Display message by using AOL Message Name (Message Dictionary)..........................32
How do call D2K Form from OAF page.........................................................................33
Implement a Search Page...............................................................................................34
How do display the drill down to details page according to criteria..............................39
How do display custom copy right on OAF page...........................................................41
How do get the value of the checkbox when selected or deselected................................41
How do insert data from OAF Page to Database table by using View Object................41
How do refresh the same page after the data has been entered......................................44
How do set the values in poplist.....................................................................................44
How do hide the specified item when user selects the particular value from Poplist....45
How do fire event? To display supplier name according to supplier id..........................48
How do create list box and add values to the list box dynamically.................................49
Create a Shuttle Region..................................................................................................50
About StackLayout, rowLayout, cellFormat region styles...............................................52
About Browser Look and Feel (BLAF)...........................................................................53
Wipro Technologies
Confidential
Page 3 of 66
Document Usage
This document can be used to develop self service web pages. The developer can know from
basic points to advanced points in OAF. This document is like a useful reference guide.
Details of Document
1
OAF ARCHITECTURE
Wipro Technologies
Confidential
Page 4 of 66
1.1
About Model
The OA Framework Model is implemented using Oracle Business Components for Java
(BC4J).
BC4J provides optimized, ready-to-use implementations of the J2EE design patterns.
Development teams can focus immediately and only, on writing business logic and user
interfaces instead of designing, coding, and debugging handcrafted application plumbing
code.
1.2
About View
1.3
About Controller
User and Application-driven interactions are handled by the OA Controller, which is pure
Java Class implementation.
Within the Model-View-Controller architecture, the OA Framework draws a clear
distinction between client and server classes.
Client classes (View and Controller) drive the HTML user interface.
Server classes (Model code) can support any client (not just OA Framework user
interfaces)
Wipro Technologies
Confidential
Page 5 of 66
2.
Key Features
2.1
2.2
2.3
OA Framework offers developers a wide range of user interface components that make the
building of applications into a more assembly process, freeing developers from the repetitive
composition of common user interface constructs.
OA Framework user interface components range from simple widgets such as buttons and
fields to compound components such as tables-in-tables and hierarchical grids.
Wipro Technologies
Confidential
Page 6 of 66
2.4
On User Interface Side, reusable components can be saved as Shared regions in the MDS
repository and reused across several pages.
Example for Shared region is LOV (list of values).
It is independent object. We can attach the same LOV to text item in several pages.
3.
OA Framework Essentials
Wipro Technologies
Confidential
Page 7 of 66
4.
Wipro Technologies
Confidential
Page 8 of 66
i) EmployeeEO.xml
ii) EmployeeEOImpl.java
Entity
2) View Objects
Wipro Technologies
Confidential
Page 9 of 66
Wipro Technologies
Confidential
Page 10 of 66
5.
Wipro Technologies
Confidential
Page 11 of 66
6.
CONTROLLER is used to enhance OA Framework page using logic for buttons, automatic
queries, dynamic WHERE clauses, JSP forwards, and the Message Dictionary.
Confidential
Page 12 of 66
We could not call methods of Entity Objects (EO) from Controller directly. We have to follow
below order to call method from location to other location.
1)
2)
3)
4)
7.
OAF Key Do's and Don'ts (Part 1) - "Top 10" Golden Rules
I don't know how many of you have come across this in the OAF Devguide, it was only by
change that I found it, thought I'd share:
There's a lot to learn when getting started with the OA Framework, but the following list of
rules are so universal -- and so fundamental -- they should be familiar to anyone who's doing
Framework development.
1) ALWAYS try to declaratively define your UI. Resort to a programmatic layout only if the UI
cannot be implemented declaratively. Programmatic layouts are difficult to customize (they
don't leverage the Personalization Framework) and may diverge from the UI Guidelines over
time.
2) NEVER change your UI layout properties in processFormRequest(). ALWAYS make
changes in processRequest(), even if that means handling an event in
processFormRequest() and then redirecting back to the same page. This ensures that the
web bean hierarchy is in a stable state when the page renders.
3) NEVER use index numbers to find beans when you want to change their properties.
ALWAYS search by name. Index numbers can change during processing.
4) NEVER change the properties of a parent bean from a child bean. This is a poor design
practice that hampers reuse while introducing fragile code (particularly if the child code
executes too late in the page rendering cycle to properly affect the parent).
5) NEVER instantiate Beans using "new OA Bean()". ALWAYS use the createWebBean()
factory methods available on the OAControllerImpl class. Not all Bean properties are
initialized correctly when you use "new."
6) NEVER create Form Beans in code (this means NEVER add nested Form beans to a
page; your Page Layout region should be the only form region). Multiple form Beans on a
page are not supported and can result in strange runtime behaviors.
7) NEVER count on your Application Module using the same database connection in
subsequent requests. For example, NEVER post and commit in separate requests. For
performance reasons, the Framework will start pooling and reusing connections in 5.7
instead of holding onto a single connection throughout the life of an Application Module.
8) NEVER use JDBC directly unless you're calling a PL/SQL routine (you should use a view
Wipro Technologies
Confidential
Page 13 of 66
8.
Confidential
Page 14 of 66
Navigation: - right click on Workspaces option in system-navigator Window and select New
OAWorkspace
Confidential
Page 15 of 66
New window will be opened, and then select WebTier under categories list.
Select OA Components option under Web Tier and select Page right side.
Wipro Technologies
Confidential
Page 16 of 66
Press OK Button.
Step 5: Enter page name as XXXWelcomePG in Name field.
You can change the package name if you want otherwise leave it as it is because the
package is already created at the time of workspace creation.
Wipro Technologies
Confidential
Page 17 of 66
Now, we will run the .xml (WelcomePG.xml) to render the OAF page on the Browser.
In above diagram, there is region1 called root region. It is container, consists items
and other regions.
Set the properties for root region (region1) in property inspector window.
Property Name
ID
Region Style
Window Title
Title
AM Definition
Value
MainRN
PageLayout
Welcome Window
Welcome Page
oracle.apps.fnd.framework.server.OAApplicationModule
Note: we are not yet creating Application Module. So, this
application module is using which is default.
Property Name
Wipro Technologies
Value
Confidential
Page 18 of 66
WelcomeTxt
messageTextInput
Enter Your Name
Enter any string to display it
on the page
(It is like Tooltip text)
Wipro Technologies
Confidential
Page 19 of 66
Page Title of
Root Region
(MainRN)
In this stage, there is no control on the OAF page. We have to create CONTROLLER on the
root region and write the code to control the OAF page.
8.
Value
ButtonLayout
Wipro Technologies
Confidential
Page 20 of 66
Value
Go
submitButton
Go
Click the button
See below screenshot once and observe the methods processRequest and
processFormRequest in the Java file (WelcomeCO.java).
Wipro Technologies
Confidential
Page 21 of 66
When press the Go button, the button related code will be executed from
processFormRequest method (like Java POST method).
The processRequest code will be executed at the time of initializing the page.
Logic to display the message Welcome <value of text item> on OAF page. Add below code
in the method processFormRequest.
Code:
if (pageContext.getParameter("Go")!=null)
{
String str=pageContext.getParameter("WelcomeTxt");
String message="Welcome "+str;
throw new OAException(message,OAException.INFORMATION);
}
In above code, Go is button name (not prompt) which is used in if condition.
WelcomeTxt is also text item id (not prompt).
When user press the Go button, the browser will send the request to middle tier and after
processing the middle tier responds to browser.
Wipro Technologies
Confidential
Page 22 of 66
Output: Enter the text OAF students in text item and press the Go button, then display
the message on MainRN (Root region).
Message: WELCOME OAF students
(Exception type: INFORMATION)
Product Branding:
The productBranding is used to place image beside corporate branding image ORACLE.
Select pageLayout components and click right mouse button, and select the
productBranding option.
Wipro Technologies
Confidential
Page 23 of 66
Wipro Technologies
Confidential
Page 24 of 66
Value
Item2 (as you like)
formattedText
Customer SUN MicroSystems-Menlo Park
We can use html tags to change font styles or display font in bold etc.
Example: Customer <b> SUN MicroSystems-Menlo Park</b>
Output:
Wipro Technologies
Confidential
Page 25 of 66
Confidential
Page 26 of 66
import oracle.apps.fnd.framework.webui.beans.form.OASubmitButtonBean;
OASubmitButtonBean goButton =
(OASubmitButtonBean)webBean.findChildRecursive("Go");
goButton.setDisabled(true);
Confidential
Page 27 of 66
Enter user name and password correct, and then press Go button.
Note: Set text item property secret as True when enter password. User could not
see the password while entering.
The below page WelcomePG will be opened.
Confidential
Page 28 of 66
Wipro Technologies
Confidential
Page 29 of 66
When user presses the Return to Security Page link, then the security page will be
opened.
How do add a returnLink dynamically
Code:processRequest(OAPageContext pageContext, OAWebBean webBean)
{
super.processRequest(pageContext, webBean);
OALinkBean returnLink =
(OALinkBean)createWebBean(pageContext, OAWebBeanConstants.LINK_BEAN,
null,"returnLink");
returnLink.setDestination("OA.jsp?
page=/oracle/apps/dem/employee/webui/EmpSearchPG&retainAM=Y");
// Retrieve and set the translated link text.
String linkText = pageContext.getMessage("AK","FWK_TBX_T_RETURN_TO_POS", null);
returnLink.setText(linkText);
// Add the return link to the page.
((OAPageLayoutBean)webBean).setReturnNavigation(returnLink);
}
Confidential
Page 30 of 66
How do call stored procedure from OAF page (Without using EO, VO)
Wipro Technologies
Confidential
Page 31 of 66
Wipro Technologies
Confidential
Page 32 of 66
Wipro Technologies
Confidential
Page 33 of 66
Create project
Create Business Component Package train.oracle.apps.ak.empsearch.server
Create Entity object (EO) under the above package.
Create Application Module (AM) under the package
train.oracle.apps.ak.empsearch.server
Application Module Name: EmployeeAM
5) Create an Employee-to-Manager Association (AO) for the self- join condition on the
FWK_TBX_EMPLOYEE table.
Wipro Technologies
Confidential
Page 34 of 66
Create ViewObject (VO) to display the data on the page. Here, VO is based on EO.
Wipro Technologies
Confidential
Page 35 of 66
Select EmpSearchEO object twice. There are two entity objects and linked the two Eos
through Association Object (AO).
10) Select Next button, and select attributes from EmpSearchEO and EmpSearchEO1.
11)
Select below columns from EmpSearchEO and EmpSearchEO1.
o EmployeeId
o FullName
o EmailAddress
12) Changes attribute name and alias as meaningful.
Wipro Technologies
Confidential
Page 36 of 66
Select Attribute
EmployeeId1
FullName
FullName1
EmailAddress
EmailAddress1
Select Next button, and observer Query. We can change query, if you select the check box
Expert Mode.
13) Now, I want to include some other condition in the above query.
QUERY:
SELECT EmpSearchEO.EMPLOYEE_ID,
EmpSearchEO.FULL_NAME AS EMPLOYEE_NAME,
EmpSearchEO.EMAIL_ADDRESS AS EMPLOYEE_EMAIL,
EmpSearchEO1.EMPLOYEE_ID AS MANAGER_ID,
EmpSearchEO1.FULL_NAME AS MANAGER_NAME,
EmpSearchEO1.EMAIL_ADDRESS AS MANAGER_EMAIL,
Flkp.meaning POSITION_DISPLAY
FROM FWK_TBX_EMPLOYEES EmpSearchEO,
FWK_TBX_EMPLOYEES EmpSearchEO1,
FWK_TBX_LOOKUP_CODES_VL flkp
WHERE EmpSearchEO.MANAGER_ID = EmpSearchEO1.EMPLOYEE_ID(+)
AND EmpSearchEO.POSITION_CODE=flkp.lookup_code
AND flkp.lookup_type=FWK_TBX_POSITIONS
Select Next button, and check mapping between Query Columns and Attribute names.
Select Finish button.
14) Add the ViewObject (EmployeeSummaryVO) to Application Module.
15) Select the application module (already created), and press right mouse button and
select the option Edit EmpSearchAM, then select the ViewObject.
Wipro Technologies
Confidential
Page 37 of 66
Wipro Technologies
Confidential
Page 38 of 66
Wipro Technologies
Confidential
Page 39 of 66
Confidential
Page 40 of 66
First, we have set the pageLayout region property AutoFooter as False. (This is very
important).
Select the pageLayout region, and press right mouse button, then select the option
Copyright and set the property prompt as you wish.
Run the page and observe the Copyright prompt at footer of the page.
How do get the value of the checkbox when selected or deselected
Solution:
Bydefault, the checkbox returns on when selected.
The checkbox returns null when deselected.
According to on and null values, we can do validation on the checkbox.
Code:
Write code in processFormRequest method for any button
String val= pageContext.getParameter("chkbox");
If (val.equals(on ))
{
System.out.println(Male);
}
If (val==null)
{
System.out.println(Female);
}
http://forums.oracle.com/forums/thread.jspa?threadID=577666&start=0&tstart=165
In this site, code has been given regarding get value of selected checkbox from VO
(Displayed multiple rows)
How do insert data from OAF Page to Database table by using View Object
Steps
1) Create view object with query.
2) Create application module and attach the view object
3) Create OAF page and attach application module.
4) Create Controller and write below code.
import oracle.apps.fnd.framework.OAApplicationModule;
import oracle.apps.fnd.framework.webui.beans.message.OAMessageTextInputBean;
import oracle.apps.fnd.framework.webui.beans.message.OAMessageLovInputBean;
import java.text.SimpleDateFormat;
import java.text.DateFormat;
Wipro Technologies
Confidential
Page 41 of 66
Wipro Technologies
Confidential
Page 42 of 66
Wipro Technologies
Confidential
Page 43 of 66
How do refresh the same page after the data has been entered
There is API forwardImmediatelyToCurrentPage used to refresh the same page
when the user presses the submit button.
Write below code in processFormRequest() method
****************************************************************
import com.sun.java.util.collections.HashMap;
HashMap params = new HashMap();
pageContext.forwardImmediatelyToCurrentPage(params,true,
OAWebBeanConstants.ADD_BREAD_CRUMB_NO);
How do set the values in poplist
Solution:1) Create View Object(VO) and write query to display the values in poplist.
VO Name: SuppliersListVO
Query:SELECT 'YES' MEANING,'Y' CODE FROM DUAL
UNION
SELECT 'NO' MEANING,'N' CODE FROM DUAL
YES is used to show for user on the OAF page. Y is used for internal purpose. The
value Y will be stored into database when user selects YES.
Set the properties for an item:Property
Item Style
Picklist view Definition
Picklist Display Attribute
Picklist Value Attribute
Value
messageChoice
train.oracle.apps.ak.suppliers.list.webui.SuppliersLis
tVO
Meaning
Code
How do hide the specified item when user selects the particular value from
Poplist
Wipro Technologies
Confidential
Page 44 of 66
2) Select the option Tuning for the same properties VO and select the check box like
below screenshot.
Wipro Technologies
Confidential
Page 45 of 66
Value
True
True
firePartialAction
onholdflagChange
True
5) Configure the item which is invisible according to value of the list item. Here, the
invisible item is EndDate. So, set the below property for the item EndDate.
Property
Rendered
Value
${oa.SuppliersListPVO1.endDateRender}
Confidential
Page 46 of 66
Confidential
Page 47 of 66
How do create list box and add values to the list box dynamically
Solution:
First, create a messageLayout region under messageComponentLayout region because
we are creating Listbox item under messageLayout region using the below code.
Wipro Technologies
Confidential
Page 48 of 66
Wipro Technologies
Confidential
Page 49 of 66
Wipro Technologies
Confidential
Page 50 of 66
Confidential
Page 51 of 66
Note: If you set the Rendered property to False for either the leading or trailing list, the
leading or trailing footer also does not render, respectively. Since the footer is directly linked
to its respective list, if the list is not rendered, the footer is irrelevant.
pageLayoutRegion
|-----stackLayout region
|----rowLayout region
|---------cellFormat region
|-------spacer (item style)
|
(width: 400)
|-------item (style: formattedText)
(Text: <b>Authority For Expenditure</b>
(Please look above screenshot for result)
|------stackLayout region
|----rowLayout region
|----cellFormat region
|-----spacer (item style)
|
(width: 400)
|-----item (style: formattedText)
(Property Text: <b>Co: 101 XXX Energy Inc</b>)
|--------stackLayout region
|-----rowLayout region
|-----cellFormat region
|------ table region
|----- item1 (style: messageStyledText)
|-----cellFormat region
|------ table region
Wipro Technologies
Confidential
Page 52 of 66
Confidential
Page 53 of 66
Example:
OA.jsp?
page=/train/oracle/apps/ak/employee/webui/EmpDetailsPG&employeeNumber={@Empl
oyeeId}&retainAM=Y&addBreadCrumb=Y&OALAF=minimal
Call the page EmpDetailsPG from any another page and observe appearance of the
EmpDetailsPG. Please find the below screen shot. (OALAF=minimal)
From above screenshot, some text is showing in green color. Try for blaf and oaText
LAFs like above.
Wipro Technologies
Confidential
Page 54 of 66
Width of a table
Table formatting
Single selection and multiple selection on a table and adding other controls to a
selection bar
Totalling a column
Detail Disclosure
Row Headers
Wrap Settings
Confidential
Page 55 of 66
Wipro Technologies
Confidential
Page 56 of 66
Wipro Technologies
Confidential
Page 57 of 66
After select the footer option, the footer and tableFooter1 components will be
created. See below screenshot.
Select the tableFooter1 and press right mouse button and select the option
addTableRow. See below screenshot.
Run the page once and you will get Add another Row button at the footer of
advancedTable.
Select total option to display total of particular column (salary). The option total
showing in above screen shot.
We need to set one property Total Value as True for salary column (column4 in below
screen shot) and run the page.
Wipro Technologies
Confidential
Page 58 of 66
See the below screenshot to know the final output of advancedTable. (Add Another
Row button, Recalculate button and total value for salary column)
After press the Add Another Row button, one blank record will be created. See below
screen shot.
Wipro Technologies
Confidential
Page 59 of 66
Wipro Technologies
Confidential
Page 60 of 66
Wipro Technologies
Confidential
Page 61 of 66
See below screen shot, after press the Add Another Row button
New row is created and added onto table, and SerialNumber is also incremented (from
6 to 7) and displayed on table. See below screenshot.
Wipro Technologies
Confidential
Page 62 of 66
From above screenshot, the value of Name is supplierNUM. It is used to get serial
number when user clicks the delete switcher at runtime.
Value: ${oa.SequenceNumberVO1.SERIALNUM} [it is SPEL]
After setting above properties, Write below code in Application Module for removing
the selected record.
public void deleteSupplier(String SupplierNumber)
{
int suppToDelete = Integer.parseInt(SupplierNumber);
OAViewObject vo = (OAViewObject)getSequenceNumberVO1();
SequenceNumberVORowImpl row=null;
int fetchedRowCount = vo.getFetchedRowCount();
System.out.println("fetchedRowCount " + fetchedRowCount);
RowSetIterator deleteIter = vo.createRowSetIterator("deleteIter");
Wipro Technologies
Confidential
Page 63 of 66
Wipro Technologies
Confidential
Page 64 of 66
If user wanted to show checkbox for onHoldFlag column, then we need to change the item
style of the onHoldFlag item as messageCheckBox. Set the below check box properties
checkedValue: Y ; uncheckedValue: N
Wipro Technologies
Confidential
Page 65 of 66
Wipro Technologies
Confidential
Page 66 of 66