Friday, May 27, 2016

Displaying Data From Data Base @OAF using ViewObject and Creating Region in wizard



Displaying Data From Data Base




In this lesson we are going to see how to display a data from the data base in OAF.
Follow the steps to display the data in OAF page from the Data Base:
  1. Create the page.
  2. Create the VO in respective BC4J and attach it to AM.
  3. Create the controller and write the logicode in Process Form Request.
To create a VO right Click on the Resources Folder of the project and then select New View Object…
To see all the steps that how to create the VO we can see in previous chapter.
Write the following Query statement in VO
SELECT * FROM mtl_system_items_b WHERE  ROWNUM < 101
After creating VO attach VO to AM (Application Module).
Now select main page right click on the main region select New -> Region Using Wizard…


Controller…
Now after creating the controller write the following code in the process Form Request.
public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
{
super.processFormRequest(pageContext, webBean);
if(pageContext.getParameter(“item1”)!=null)
{
/* The below code line is used to initialize the application module */
OAApplicationModule am=(OAApplicationModule)pageContext.getApplicationModule(webBean);
/* The below code line is used to initialize VO*/
OAViewObject vo=(OAViewObject)am.findViewObject(“ItemsVO1”);
/* ItemsVO1 is the instance name in AM which is the original name of the VO */
vo.executeQuery();
}
}


OUTPUT::



No comments:

Post a Comment