<-----Google Analytics Code Start----> <-----Google Analytics Code Close---->
Skip to content

Green

color

Default screen resolution  Wide screen resolution  Increase font size  Decrease font size  Default font size  Skip to content Default color Pink color Green color Green color
Home
This website has now moved to http://apps2fusion.com





OA Framework Training Tutorial 03 | Print |  E-mail
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.

For simplicity
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
Comments (26)add
...
written by Anjani , July 12, 2007
Hi Anil,
Thank you very much for taking out sometime from your busy schedule and
providing us with this tutorial.
I can create person in JDeveloper but after I had deployed it in Apps environment,when I click on CreatePerson it shows the Search page instead of ManagePerson page.
I've moved all the class files in binary mode and others in Ascii mode
in apps environmentwith with same folder structure.
Please give some solution.
...
written by Anil Passi , July 12, 2007
Hi Anj

Did you import both the pages into MDS, i.e. main page and manage person page?

Thanks,
Anil
...
written by kumar.ch , July 12, 2007
hi Anil,

where do we write business logic in OAframework.

regards
ram
...
written by Anil Passi , July 12, 2007
In BC4J, to begin with do all your validations in Entity Object
...
written by Raneem , September 13, 2007
hi Anil,
I have a problem, when i click the create button the fields is not displayed,
and an error occurs, please help.

oracle.apps.fnd.framework.OAException: No data found for region (/oracle/apps/ak/xxperson/webui/xxPersonMainPG).


oracle.adf.mds.MetadataDefException: Unable to find component with absolute reference = /oracle/apps/ak/xxperson/webui/xxPersonMainPG, XML Path = C:softwareAOJDeveloperSoftjdevhomejdevmyclassesJR ADXML;C:softwareAOJDeveloperSoftjdevhomejdevmyproj ects;C:softwareAOJDeveloperSoftjdevbinjdevoamdsxml wk. Please verify that the reference is valid and the definition of the component exists either on the File System or in the MDS Repository.

oracle.adf.mds.MetadataDefException: Unable to find component with absolute reference = /oracle/apps/ak/xxperson/webui/xxPersonMainPG, XML Path = C:softwareAOJDeveloperSoftjdevhomejdevmyclassesJR ADXML;C:softwareAOJDeveloperSoftjdevhomejdevmyproj ects;C:softwareAOJDeveloperSoftjdevbinjdevoamdsxml wk. Please verify that the reference is valid and the definition of the component exists either on the File System or in the MDS Repository.

...
written by Ravi Chandra Nuka , September 20, 2007
How can I display default login info in jsp form and How to use radio buttons and check boxes. I have used 3 radio buttons in a radio group but by default it is saving the last radio button. How can I avoid this problem and How to locate the textfields at desired postions on a page like normal canvas design in forms 6i
...
written by cpsiva , September 30, 2007
Hi Anil,

Great Tutorial on OA Framework. I really liked it. I have a small problem in the CreatePersonMethod in the PersonAM. The if condition is failing.

public void createPersonMethod (String pAction, String pPersonId)
{
OAViewObjectImpl pervo =getPersonDetailsVO1();
System.out.println("==================in PersonAM CreatePersonMethod");
if (! pervo.isPreparedForExecution())
{
System.out.println("inside createPersonMethod");
pervo.executeQuery();
Row prow = pervo.createRow();
pervo.insertRow(prow);
prow.setNewRowState(Row.STATUS_INITIALIZED);
}
else
{
System.out.println("not in CreatePersonMethod");
}
}

if I remove the "!" from the if condition it works fine. Please advise.

Appreciate your help.
Thanks and regards.

Siva

no current row for view
written by swapnilsrivastava , November 12, 2007
hi anil,
I have developed a jsp for insertion and updation put when the controller redirects control to next page and i want to insert a new record or update it it shows no current row for view.
we earlier developed jsp following ur tips. But now i have more complexities to address:
Plz provide some clarifications regarding:
1.How do we write update/create method in the A.M for the changed scenario( because i followed exactly what u did but it's probably insufficient for present requirements.)
I have made a view which is the combination of 5 tables, i have defined the VO accordingly
so the search is working fine but there are lot of issues when i want to update/delete/add.
plz provide some clarity about how to define the methods in AM accordingly.
Do reply.

how to create radio group buttons in ADF,JSP technology
written by srinivas sammeta , November 13, 2007
hi
i have created three radio buttons, but by default three are enabled when i am running the page.

my requirement is when the form is running only one button is enable and also when i am select first radio button remaing are deselect.

so please send the code in adf technology and also which components are used i.e. selectBooleanRadioButton, SelectOneRadio, ShowOneRadio.

thanks
SrinivasSL
problem while deploying the page in server
written by sumo , January 30, 2008
oracle.apps.fnd.framework.OAException: Could not load application module 'oracle.apps.fnd.frame.sehema.PersonAM'.
at oracle.apps.fnd.framework.webui.OAJSPApplicationRegistry.registerApplicationModule(OAJSPApplicationRegistry.java:279)
at oracle.apps.fnd.framework.webui.OAJSPApplicationRegistry.registerApplicationModule(OAJSPApplicationRegistry.java:7smilies/cool.gif
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:1166)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:497)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:41smilies/cool.gif
at _oa__html._OA._jspService(_OA.java:8smilies/cool.gif
at oracle.jsp.runtime.HttpJsp.service(HttpJsp.java:119)
at oracle.jsp.app.JspApplication.dispatchRequest(JspApplication.java:417)
at oracle.jsp.JspServlet.doDispatch(JspServlet.java:267)
at oracle.jsp.JspServlet.internalService(JspServlet.java:186)
at oracle.jsp.JspServlet.service(JspServlet.java:156)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:58smilies/cool.gif
at oracle.jsp.provider.Jsp20RequestDispatcher.forward(Jsp20RequestDispatcher.java:162)
at oracle.jsp.runtime.OraclePageContext.forward(OraclePageContext.java:187)
at _oa__html._RF._jspService(_RF.java:102)
at oracle.jsp.runtime.HttpJsp.service(HttpJsp.java:119)
at oracle.jsp.app.JspApplication.dispatchRequest(JspApplication.java:417)
at oracle.jsp.JspServlet.doDispatch(JspServlet.java:267)
at oracle.jsp.JspServlet.internalService(JspServlet.java:186)
at oracle.jsp.JspServlet.service(JspServlet.java:156)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:58smilies/cool.gif
at org.apache.jserv.JServConnection.processRequest(JServConnection.java:456)
at org.apache.jserv.JServConnection.run(JServConnection.java:294)
at java.lang.Thread.run(Thread.java:534)

problem while deploying the page in server
written by sumo , January 30, 2008
oracle.apps.fnd.framework.OAException: Could not load application module 'oracle.apps.fnd.frame.sehema.PersonAM'.
at oracle.apps.fnd.framework.webui.OAJSPApplicationRegistry.registerApplicationModule(OAJSPApplicationRegistry.java:279)
at oracle.apps.fnd.framework.webui.OAJSPApplicationRegistry.registerApplicationModule(OAJSPApplicationRegistry.java:7smilies/cool.gif
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:1166)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:497)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:41smilies/cool.gif
at _oa__html._OA._jspService(_OA.java:8smilies/cool.gif
at oracle.jsp.runtime.HttpJsp.service(HttpJsp.java:119)
at oracle.jsp.app.JspApplication.dispatchRequest(JspApplication.java:417)
at oracle.jsp.JspServlet.doDispatch(JspServlet.java:267)
at oracle.jsp.JspServlet.internalService(JspServlet.java:186)
at oracle.jsp.JspServlet.service(JspServlet.java:156)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:58smilies/cool.gif
at oracle.jsp.provider.Jsp20RequestDispatcher.forward
...
written by Anil Passi , January 30, 2008
Hi Sumo

the error says
oracle.apps.fnd.framework.OAException: Could not load application module 'oracle.apps.fnd.frame.sehema.PersonAM'

try this on server

ls -l $JAVA_TOP/oracle/apps/fnd/frame/sehema/PersonAM*

Looks like you got some typos

Also, it helps to see the full error stack

Thanks,
Anil Passi
Can I link a JSP page with Oracle Apps Page which is desing in OA Framework ,
written by Brajesh , January 31, 2008
I want ot know that, i need to link a JSP page from Oarcle Apps form, which is desing with OA FrameWork, and the JSP page will dynamicaly generate a page as per my parameter given in form filed, g will it possible. If possible please tell me the procedure,or logic.
Thanks & regards
Brajesh
...
written by sumo , January 31, 2008
Thank u Anil
Now i am able to get the page

Hi Anil
written by brajesh , January 31, 2008
I want to link a jsp page which will generate dynamically from a oracle Apps form, by clicking a button, and the form is design on OA Framework, and i want to put a diagrma on JSP page the digram will generated as per my given parameter in My OA form, and the diagram will show the hierachy of Job prograssion IN HRMS, i link it to HRMS database table. Please tell me the solution for that.
Thanks & regards
Brajesh
Can we download a page from the server
written by sumo , January 31, 2008
Hi Anil,

You have given solution to deploying a OA Framework page in server but Can we download a OA Framework page from the server ?
If yes , after downloding can we do some modification on that page?

Thank You.
...
written by Anil Passi , January 31, 2008
Hi Sumo

You can use jdr_utils for that purpose, i think the api name is printdocument

You can google on jdr_utils and find the info.

Having said so, why do you wish to download page from database.
Simply get that page from $PRODUCT_TOP/mds/../../

Thanks,
Anil
...
written by sumo , January 31, 2008
thakn You.
After downloading the page from the database i want do some modification on that as well as i want to add something on that.
Can i Do that?
is there any process for it?

...
written by kal123 , February 05, 2008
Thank you Anil for providing such an excellent tutorial.

I'm having one problem...when I hit a "Create Person" button on main page...It's giving following error message.


Exception:
oracle.adf.mds.MetadataDefException: Unable to find component with absolute reference = /oracle/apps/ak/xxperson/webui/managePersonPG, XML Path = C:jdev_install_dirjdevhomejdevmyclassesJRADXML;C: jdev_install_dirjdevhomejdevmyprojects;C:jdev_insta ll_dirjdevbinjdevoamdsxml wk. Please verify that the reference is valid and the definition of the component exists either on the File System or in the MDS Repository.
at oracle.adf.mds.internal.MetadataManagerBase.findElement(MetadataManagerBase.java:1350)
at oracle.adf.mds.MElement.findElement(MElement.java:97)
at oracle.apps.fnd.framework.webui.JRAD2AKMapper.getRootMElement(JRAD2AKMapper.java:501)
at oracle.apps.fnd.framework.webui.OAWebBeanFactoryImpl.getWebBeanTypeDataFromJRAD(OAWebBeanFactoryImpl.java:371smilies/cool.gif
at oracle.apps.fnd.framework.webui.OAWebBeanFactoryImpl.getRootApplicationModuleClass(OAWebBeanFactoryImpl.java:3451)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:999)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:502)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:423)
at _OA._jspService(OA.jsp:40)
at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:317)
at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:465)
at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:379)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:727)
at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:306)
at com.evermind.server.http.ServletRequestDispatcher.forward(ServletRequestDispatcher.java:209)
at com.evermind.server.http.GetParametersRequestDispatcher.forward(GetParametersRequestDispatcher.java:189)
at com.evermind.server.http.EvermindPageContext.forward(EvermindPageContext.java:199)
at _OA._jspService(OA.jsp:45)
at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:317)
at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:465)
at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:379)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:727)
at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:306)
at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:767)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:259)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:106)
at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:803)
at java.lang.Thread.run(Thread.java:534)






...
written by Anil Passi , February 05, 2008
Hi Kal123

OAF can not find the XML file in location below

jdevHomeDirectorymyprojectsoracleappsakxxpersonwebuiman agePersonPG.xml

Thanks,
Anil Passi
...
written by Kalyan , February 05, 2008
Hi Anil,

I have managePersonPG.xml at the right location
jdevHomeDirectory/ myprojectsxxtoracleappsakxxpersonwebuimanagePer sonPG.xml

Still I'm getting the same error message. Could you pls help me out?

Thx
Kal123
...
written by Kal123 , February 05, 2008
Hi Anil,

I have resolved this issue...It's working good...thx for your help.

Kal
...
written by Kal123 , February 05, 2008
Hi Anil,

I am having one problem here. When I hit "create Person" button, It opens up "insert and Update Person" page with personId, Firstname, LastName, email, studentFlag,NameofUniversity filled with last record, I suppose all fields should be blank when latter page is opened up.
In addition to that there is one more issue I have, After I fill in fields with new record and hit "Commit Data", then Previous record is getting overwritten (Infact existing record being deleted) in underlying XX_PERSON_DETAILS table.

Could you pls advise me on this where I went wrong ?

Thanks!!

...
written by Anil Passi , February 05, 2008
This will happen if your AM is retained, and hence the View Object cache is held within the memory. Hence the VO still remains executed for the previous record, which means VO pointer points old record. Surely, if you change data, the data of earlier record will be updated and commited.

For the CreatePerson, from processRequest, you need to initialize VO so that it points to a fresh new vanilla record in memory.

Thanks,
Anil Passi
...
written by Kal123 , February 07, 2008
Hi Anil,

I am getting following error while trying to run main Page.


The target xxPersonMainCO.java cannot be started as a servlet, because the class xxt.oracle.apps.ak.xxperson.webui.xxPersonMainCO does not extend javax.servlet.GenericServlet.
The target xxPersonMainCO.java cannot be started as an application, because the class xxt.oracle.apps.ak.xxperson.webui.xxPersonMainCO does not have a main method.

Please advise me on this issue.

Thanks!!!
...
written by Kal123 , February 07, 2008
Hi Anil,

The following is the code that I've used from your tutorial. This code is in ProcessRequest Method of Controller Class for xxManagePersonPG

public void processRequest(OAPageContext pageContext, OAWebBean webBean)
{
super.processRequest(pageContext, webBean);
String paramPersonAction = pageContext.getParameter("xxParamActionOnPerson");
String paramPersonId = pageContext.getParameter("xxParamPersonId");
OAApplicationModule personam = pageContext.getApplicationModule(webBean);
Serializable personParamList[] = {paramPersonAction,paramPersonId};

if (paramPersonAction !=null && paramPersonAction.equals("createPerson"))
{
personam.invokeMethod("createPersonMethod", personParamList);
}
}

The following is the code for CreatePersonMethod in Application Module.

public void createPersonMethod(String pAction, String pPersonId)
{
OAViewObjectImpl pervo = getXxPersonDetailsVO1();
if( !pervo.isPreparedForExecution())
{
pervo.executeQuery();
Row prow = pervo.createRow();
pervo.insertRow(prow);
prow.setNewRowState(Row.STATUS_INITIALIZED);
}
}

You're sayin "For the CreatePerson, from processRequest, you need to initialize VO so that it points to a fresh new vanilla record in memory." I think, we're already initializing VO as per code given above

OAViewObjectImpl pervo = getXxPersonDetailsVO1();

Could you please help me where I'm missing here? Please tell me where exactly we need to initialize Vo sothat it points to New record in memory.

Thanks!!!






You must be logged in to a comment. Please register if you do not have an account yet.

busy