SPEL In OAF

Ratings:
(4.3)
Views: 4458
Banner-Img
Share this blog:

SPEL stands for “Simplest Possible Expression Language”.

SPEL is used to carry the values dynamically. SPEL will get the value dynamically at runtime. SPEL is the Boolean Value (True / False). The syntax of SPEL is:

1

Now let us see the previous chapter output which shows the Employee Information when we click on “Get Employee Information” button now the same output we are adding one image icon so that it appears to each and every row as shown in the below figure:

2

Now we will see the process how to add edit image for each row in a table. For that first we need a page structure as follows:

3

In the above page structure, we created a region Using Wizard and the region style is “Table”.  Item1 is the submit button whenever we click on the Submit Button(Get Employee Information) it displays the employee information as shown in the below figure:

4

Now go to the table region, right click on the table region select New -> Item.

In the Property Inspector of item do the following changes:

  1. Select the Item style as
  2. In Image, URI gives the name of the image for example for edit image we have predefined images in “p9879989_R12_GENERIC\jdevhome\jdev\myhtml\OA_MEDIA” , give the following image in Image URI /OA_MEDIA/detailsicon_enabled.gif.
  3. In client action select Action Type as “fireAction“.
  4. In client action give Event name as “Edit“.

Now the page structure looks like:

5

Now run the page and click on the button “Get Employee Information” so that the output looks like the above picture what we have seen early.

Now, whenever we click on the image item then it must show us the information in a different form, for that we need to write the following code in processFormsRequest of controller:

if("Edit".equals(pageContext.getParameter(EVENT_PARAM)))

{

pageContext.setForwardURL("OA.jsp?page=/xxapples/oracle/apps/po/insertingrecords/webui/InsertDataPG",

null,

OAWebBeanConstants.KEEP_MENU_CONTEXT,

null,

null,

true,

OAWebBeanConstants.ADD_BREAD_CRUMB_YES,

OAWebBeanConstants.IGNORE_MESSAGES);

}

In IF condition “Edit” is the Client Action Event Name which we have given. The remaining code logic is same which we used in the previous chapter takes us to create employee page but here we need to carry the data to that page rather than creating an employee.

To achieve this requirements we need to create a spell, keep continue reading so that we will come to know how to create a SPELL in OAF.

SPEL creation in OAF, we know the syntax of SPEL now we need to create a SPEL for the image item in a table.

The SPEL value for the above is as follows:

${oa.EmployeeSearchVO1.Empno}

EmployeeSearchVO1 is the name of the VO which is used to get the details of employees.

Empno is the primary key value (attribute name)/ column name of the table in view.

Now we need to pass the above spel to image, for that select the image and then in Property Inspector,

Client Action -> Parameters

6

Once we click on the icon a Parameters window will get open in that, click on Add Parameters button and then give some name (example pempno) in the value pass the SPEL what we created ( ${oa.EmployeeSearchVO1.Empno} ). After giving a name and passing SPEL value in the Value field click on OK button.

7

Now we need to call this parameter in the Create Employee page CO because whenever we click on the image item in the table list showing employee details it takes us to the Create Employee Page, but it will not carry any values here our task is to carry values.

So, therefore, we need to write the code in processRequest of the controller class of Insert Employee details page. The code is as follows:

public void processRequest(OAPageContext pageContext, OAWebBean webBean)

{

super.processRequest(pageContext, webBean);

BharathAMImpl am=(BharathAMImpl)pageContext.getApplicationModule(webBean);

if(pageContext.getParameter("pempno")!=null)

{

String hid = pageContext.getParameter("pempno").toString();

String whereclause = "EMPNO='"+hid+"'";

am.getEmployeeCreateVO1().setWhereClause(null);

am.getEmployeeCreateVO1().setWhereClause(whereclause);

am.getEmployeeCreateVO1().executeQuery();

}

else

{

am.InsertEmployeeRecord();

}

}

Now rebuild the code, rebuild the pages run the Employee Information Page, click on the Get Employee Information button and then click on the image item which is displayed on each available rows so that it takes us to create employee page, but here it carries the row values. The sample output is shown in the below figure:

8

Check out our Popular Trainings  Structure of OAF Advantages and Dis-Advantages of OAF Oracle data guard Training in Chicago Creating First OAF Page in Project

You liked the article?

Like: 0

Vote for difficulty

Current difficulty (Avg): Medium

EasyMediumHardDifficultExpert
IMPROVE ARTICLEReport Issue

About Author

Authorlogo
Name
TekSlate
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 in the market.