|Receive Email for New Articles|
|OA Framework Training Tutorial 03||| Print ||
|Written by Anil Passi|
|Wednesday, 11 July 2007|
In this tutorial, we will see how a new record can be added to a table using OA Framework screen.
We shall continue from where we left in the previous tutorial.
CO Controller class. A java class attached to the page/region within a page.
PFR processFormRequest [a method in controller class that is invoked when an action takes place in screen, just like good old triggers in D2K]
PR processRequest [a method in controller class that is invoked when a page loads in the browser]
Lets say the business requirement is
1. Add a button labelled "Create Person"
2. When this button is clicked, then processFormRequest(PFR) of the controller will be called in the main page [ie. xxPersonMainPG].
3. From the PFR of CO, call another screen named managePerson, by retaining the AM. managePersonPG screen will have one single record using which we will facilitate both updates and inserts to person table. (this is your design approach, I have chosen to use the same screen[managePersonPG] for both inserts and updates to person table).
This example is about inserts into the person table.
4. The navigation now moves to managePersonPG screen, and the Controller method processRequest() of managePersonPG screen will now be called.
(Note:- remember that processRequest is called as soon as the page is about to be rendered in browser)
5. In processRequest of managePersonPG screen, we will initialize a blank record, so that fresh inserts can be done.
6. On managePersonPG screen, a button named "Commit Data" will be available.
7. After entering data into the fields/record, user will click "Commit Data", hence invoking processFormRequest of the controller inmanagePersonPG.
From processFormRequest, we will invoke a method in AM, that will commit the transaction. Name of this method in CO is savePersonToDatabase()
8. After doing commit, we navigate back to the mainPage, i.e. back to xxPersonMainPG using pageContext.setForwardURL
Why do we need Step 5?
Answer:- Here we have fields in screen that map to columns within view object. When data is entered in these fields, these will then get transferred into view object record(in memory), when form is submitted. Hence for this purpose, we need to create a blank record in VO[view object], by callingvo.createRow, so that user can enter data into that row.
When a commit takes place; how does OA Framework know whether an insert or update must be done?
In this case we are setting the status of the record to STATUS_INITIALIZED. Once a commit takes place, Framework will then internally change the status of the row to update.
I want to default value into personid field from a database sequence. How do I do that?
One way of doing this is by defaulting a value at the time of blank record being created in VO. vo.createRow will call create() method in Entity Object. This is equivalent of when-create-record trigger in D2K.
What are the steps in tutorial?
1. Create a button on the main page, to "Add new Person". This button when clicked will raise an event named createPerson.
This event can then be trapped in PFR of the controller.
Click here for Video Link [creating this button and raising event]
2. In the mainPage's CO, inside PFR, handle the click of button "create new Person".
Call managePerson page, passing it parameter named xxParamActionOnPerson=createPerson
Click here for a demonstration of this step
3. Build a managePersonPG OA page using jDeveloper. This page will present user with a record to enter a new person.
Also add a button "Commit Data" to this page.
Click here for video link
4. Set a new controller for the new page xxManagePersonPG
In PR(processRequest) of the CO for xxManagePersonPG, call an AM method to initialize record(provided action is createRecord). Remember that processRequest is called when the page loads.In the corresponding AM method, initialize the record.
Click here for video link
6. Final step to handle a commit on managePersonPG, and to redirect the user back to the original main page[xxPersonMainPG ], after the new person has been created[after commit].
Test this (complete missing step to generate sequence)
Click here to see the last step of this tutorial
written by Anjani , July 12, 2007
written by kumar.ch , July 12, 2007
written by Raneem , September 13, 2007
written by Ravi Chandra Nuka , September 20, 2007
written by cpsiva , September 30, 2007
no current row for view
written by swapnilsrivastava , November 12, 2007
how to create radio group buttons in ADF,JSP technology
written by srinivas sammeta , November 13, 2007
Can I link a JSP page with Oracle Apps Page which is desing in OA Framework ,
written by Brajesh , January 31, 2008
written by brajesh , January 31, 2008
Can we download a page from the server
written by sumo , January 31, 2008
written by kal123 , February 05, 2008
written by Kalyan , February 05, 2008