Creating Search Page

25 October, 2018


Related Blogs

In this lesson we are going to see how to create the Search page according to the document. According to the MD-050 document we need to create Manual Search Page. So let us see how to crate a Manual search page step wise:

  1. Create One new page on the project.
  2. Attach AM to the project.
  3. Design the page structure.

For example: Page Name: SearchPG Attached AM Name: The below figure shows the page structure of the Search Page, which contains 3 message Text Input items for searching and down one table layout region.   Here the search result will be displayed in table format so here we are adding images for update and detail of the resultant rows in OAF page. The below picture shows the page structure of the search page: 44 The below figure shows the page structure output of the Search Page: 45 Still now we just created the page structure but the page is not yet validated properly.   After creating page structure we need to create the Method in AM for search operation, it means if we are entering patient Id then in the where condition SQL Query must filter the Rows according to the entered Patient Id related similarly for Patient Name and Patient Phone Number too. So therefore we need to write a SQL data retrieval Query, create one VO and write the Query in the VO Qeury area:   VO Name: SearchVO   Package Name:   Write the Following Query in the query region of VO: SELECT * FROM XXSTIRLING_PATIENT_ENTRY_TABLE WHERE PATIENT_ID LIKE NVL(:1, PATIENT_ID) AND PATIENT_NAME LIKE NVL(:2, PATIENT_NAME) AND PHONE_NUMBER LIKE NVL(:3, PHONE_NUMBER)   After Creating VO attach VO to the AM. After attaching create method in AM, the following code shows the java code of creating Method in AM.   public void xxSearchPatient (OAPageContext pc, OAWebBean wb) { String pid = null; String name = null; String phno = null; SearchVOImpl vo1= getSearchVO1(); if (pc.getParameter("item1")!=null) { pid = pc.getParameter("item1").toString(); vo1.setWhereClauseParam(0,pid); } else { vo1.setWhereClauseParam(0,null); } if(pc.getParameter("item2")!=null) { name = pc.getParameter("item2").toString(); vo1.setWhereClauseParam(1,name); } else { vo1.setWhereClauseParam(1,null); } if(pc.getParameter("item3")!=null) { phno = pc.getParameter("item3").toString(); vo1.setWhereClauseParam(2,phno); } else { vo1.setWhereClauseParam(2,null); } vo1.executeQuery(); } Create One controller in Search page and initialize the AM in the SearchPage  Controller, note that we already initialized AM in Patient Entry page Controller. Now we are initializing AM in SearchPage Controller, initialize the AM in ProcessRequest as follows:   StirlingAMImpl am= (StirlingAMImpl)pageContext.getApplicationModule(webBean);   According to the page output we need to validate three buttons:

  1. Search Button
  2. Clear Button
  3. Add New Patient.

Search Button, Clear Button, and Add New Patient buttons Validation code in Process Form Request is as follows: StirlingAMImpl am= (StirlingAMImpl)pageContext.getApplicationModule(webBean); if(pageContext.getParameter("item4")!=null) { am.xxSearchPatient(pageContext,webBean); } else if(pageContext.getParameter("item6")!=null) { OAMessageTextInputBean mstb = (OAMessageTextInputBean)webBean.findChildRecursive("item1"); mstb.setValue(pageContext,null); OAMessageTextInputBean mstb1 = (OAMessageTextInputBean)webBean.findChildRecursive("item2"); mstb1.setValue(pageContext,null); OAMessageTextInputBean mstb2 = (OAMessageTextInputBean)webBean.findChildRecursive("item3"); mstb2.setValue(pageContext,null); } else if(pageContext.getParameter("item8")!=null) { pageContext.setForwardURL("OA.jsp?page=/xxstirling/oracle/apps/po/stirlingprj/webui/StrilingPG", null, OAWebBeanConstants.KEEP_MENU_CONTEXT, null, null, true, OAWebBeanConstants.ADD_BREAD_CRUMB_YES, OAWebBeanConstants.IGNORE_MESSAGES); }   Rebuild the code and run the page the below image shows the search page with results after clicking on Search Button:   46 If we observe in the output we created two image items one is for Update and Other is for Details of the patients. We not yet validated the Edit and Update images. The next lesson shows how to create Update page and the page structure of the Update page and output of Update, but for Update the values must be carried so hence we know that to carry values we will create SPEL in OAF. Check out our Popular Trainings  Structure of OAF Advantages and Dis-Advantages of OAF Oracle RAC DBA Training in Houston Creating First OAF Page in Project

About Author


Author Bio

TekSlate is the best online training provider in delivering world-class IT skills to individuals and corporates from all parts of the globe. We are proven experts in accumulating every need of an IT skills upgrade aspirant and have delivered excellent services. We aim to bring you all the essentials to learn and master new technologies in the market with our articles, blogs, and videos. Build your career success with us, enhancing most in-demand skills .