概述
在ADF项目的开发中,经常会发现大家忽略了一个Operation的使用,即ExecuteWithParams。文本主要描述了如何在ADF应用中使用ExecuteWithParams。
实现
1、创建ADF应用
2、基于HR Schema的Departments表创建Entity Object, View Object,同时创建Application Module,添加View Object的实例到Data Model中
3、为DepartmentsView(View Object)添加名为bv_deptname的Bind Variable,类型为String
4、为DepartmentsView添加View Criteria,相关条件如图:
5、打开Application Module的Data Model面板,选择在步骤2中添加的View Object的实例,点击Edit进行属性编辑
6、从Available中选择刚创建成功的View Criteria到Selected,点击OK完成。此时需注意下面的bv_deptname变量,该变量将会作为该View Object实例的数据过滤条件
7、新建名为pre-filter-taskflow的Bounded-Task-Flow(with jsff),从Data Controls面板中拖动DepartmentsView1中的ExcecuteWithParams Operation到刚创建成功的pre-filter-taskflow,作为该task-flow的default activity,为方便处理,在Edit Action Binding页面中为bv_deptname变量绑定值A。需要说明的是,在实际应用开发中,该值一般会通过EL表达式进行绑定,例如:绑定到pageFlowScope变量或SessionScope中的变量等
8、在页面中添加View,名为Table,拖动DepartmentView1到页面,将展现形式设置为Table,根据设想,若先执行ExecuteWithParams,则该Table中展示的应为过滤后的数据
9、添加Control Flow Case到pre-filter-taskflow,由ExcecuteWithParams指向Table,添加后的pre-filter-taskflow如下:
10、新建页面index.jspx,将该pre-filter-taskflow作为页面的region拖到index.jspx页面中。
11、运行该应用,查看结果
本文转自Oracle Seeker:http://oracleseeker.com/2009/10/28/execute_with_params/