Tue. Mar 9th, 2021

Requirement: Sometimes we need to filter the ViewObject Data and the result we want to use only inside the Managed Bean or any other Java classes. Thus, in such cases, we can make use of the getFilteredRows method.

Solution: For solution of the above requirement follow the steps as shown below:

Step 1: Create an Oracle ADF Fusion Web Application.

Create a Business Components from Tables for the Employees table of the HR schema of the Oracle Database 11g XE Edition.

Create or expose the AppModuleImpl.java class.

Step 2: Create a demo.jspx page inside the ViewController project.

Drag and drop an af:inputText and set label=”Enter Department ID”. and binding=”#{pageFlowScope.MyBean.departmentIdBinding}”

Drag and drop af:button and set text=”Search” and actionListener=”#{pageFlowScope.MyBean.searchActionListener}”

Thus, the complete code for the demo.jspx is shown below:

<?xml version='1.0' encoding='UTF-8'?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1" xmlns:f="http://java.sun.com/jsf/core"
    <jsp:directive.page contentType="text/html;charset=UTF-8"/>
        <af:document title="demo.jspx" id="d1">
            <af:form id="f1">
                <af:inputText label="Enter Department ID" id="it1"
                <af:button text="Search" id="b1" actionListener="#{pageFlowScope.MyBean.searchActionListener}"/>

And the complete code for MyBean.java class is as shown below:

package susantotech.com;

import javax.el.ELContext;
import javax.el.ExpressionFactory;

import javax.el.ValueExpression;

import javax.faces.application.Application;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;

import model.AppModuleImpl;

import oracle.adf.view.rich.component.rich.input.RichInputText;

import oracle.jbo.Row;
import oracle.jbo.ViewObject;

public class MyBean {
    private RichInputText departmentIdBinding;

    public MyBean() {

    public void setDepartmentIdBinding(RichInputText departmentIdBinding) {
        this.departmentIdBinding = departmentIdBinding;

    public RichInputText getDepartmentIdBinding() {
        return departmentIdBinding;

    public void searchActionListener(ActionEvent actionEvent) {
        int departmentIdvalue = 0;
        if (null != departmentIdBinding.getValue()) {
            departmentIdvalue = Integer.parseInt((String) departmentIdBinding.getValue());
        AppModuleImpl appModule = (AppModuleImpl) resolvElDC("AppModuleDataControl");
        ViewObject employeesVo = appModule.getEmployeesVO1();
        Row filteredRows[] = employeesVo.getFilteredRows("DepartmentId", departmentIdvalue);
        System.out.println("Filtered Employees for Department " + departmentIdvalue + " are");
        for (Row r : filteredRows) {
            System.out.println(r.getAttribute("FirstName") + " " + r.getAttribute("LastName"));

    public Object resolvElDC(String data) {
        FacesContext fc = FacesContext.getCurrentInstance();
        Application app = fc.getApplication();
        ExpressionFactory elFactory = app.getExpressionFactory();
        ELContext elContext = fc.getELContext();
        ValueExpression valueExp =
            elFactory.createValueExpression(elContext, "#{data." + data + ".dataProvider}", Object.class);
        return valueExp.getValue(elContext);

Step 3: Now, create a page definition file for the demo.jspx page.

Create an Iterator for the EmployeesVO1 as shown below.

Save all and run the application. Thus, the ran application is shown below:

Enter the Department ID value as 60. Click on the Search button.

Now, let me go to the console of the JDeveloper and we can see the output as shown below:

Hence, the solution to our requirement.

If you like the post please comment, share, and do join me on Facebook. Please subscribe to my YouTube Channel for video tutorials.

Thanks & Regards,
Susanto Paul

 94 total views,  2 views today

By Susanto Paul

Susanto is an Oracle ACE, a qualified MCA, MBA, and a highly-skilled Senior Oracle Specialist. He is an enthusiastic Blogger and YouTuber who helps learners to solve their complex problems more efficiently. He has 9+ years of experience in multiple technologies like AWS, Oracle ADF, Oracle APEX, Oracle JET, Oracle VBCS, Oracle IDCS, Oracle PL/SQL, Oracle Integration Cloud, Java, JDBC, Servlets, JSP, Spring, Hibernate, HTML5, CSS3, JavaScript, TypeScript, NodesJS, Angular, MySQL, Oracle WebLogic Server, JUnit, JMeter, Selenium Web Driver, etc. He is a certified: Oracle Certified Professional Java SE 6 Programmer, Oracle ADF 11g Certified Implementation Specialist, Oracle Cloud Platform Application Integration 2020 Certified Specialist, Oracle Cloud Infrastructure Foundations 2020 Certified Associate, and Oracle Cloud Infrastructure Developer 2020 Certified Associate

Leave a Reply

Your email address will not be published. Required fields are marked *