Anda di halaman 1dari 4

In this example we will create a search page which will allow user to search the

employee.

1) Create an View Object with Name EmpDeptViewObj with following query :-


SELECT first_name,last_name,email,phone_number,hire_date,salary,
department_name FROM employees e, departments d
WHERE e.department_id=d.department_id

You have created the same view object in lesson 3.


2) Create a new jspx page with name EmpSearch.jspx.
3) Set the navigation rule between the EmpList page and EmpSearch page with
name EmpSearch.

4) Click on the tab to return to EmpSearch page. In the strcture window expand the
f:view node.
5) Right click on the h:form node and select Insert inside h:formADF Faces Core.
6) Select Panel page option from the Insert ADF faces Core item window.
7) Change the title of the window to Employee Search.
8) From the data control palette, select the EmpDeptViewObj view object and drop it
on the af:panelPage node. From the context menu, select FormsADF Search
Form.
9) From the data control palette, select the EmpDeptViewObj view object and drop it
on the af:panelPage node. From the context menu, select TableADF Read
Only table.

10) Click ok on the Edit Table Columns window.


11) Right click any where in the page and select go to page definition.
12) Now here under the executable node inside the structure window, you will see
EmpDeptViewObjIterator node. It represents the binding to the Iterator. This
allows the Iterator to access and iterate over the EmpDeptViewObj view object.

In ADF we can set a view object to be in Find mode, which means any values
entered in the fields to which this view object is bound, will return the results
based on the given field values.

To achieve this, Right-click the executables node, and from the context menu,
select Insert inside executables > invokeAction.
13) Set the ID property to ForceFindModeAlways and the Binds property to the Find
action.
14) Click the Advanced tab, and set the RefreshCondition to the expression:
#{bindings.EmpDeptViewObjIterator.findMode == false}
15) Move the ForceFindModeAlways action to be first in the list of executables. This
insures the page is invoked in 'Find' mode.
16) Now we will create one more Iterator which is bind to the result table on the
search page.
17) Right-click the executables node, and from the context menu, select Insert inside
executables > Iterator.
18) Set the Iterator ID to EmpDeptTableIterator.
19) When we initially dropped the EmpDeptViewObj to the page and created the ADF
read only table, it was automatically bound to the EmpDeptViewObjIterator. Now
this Iterator is the one we have forced to stay in find mode. So we need to change
the iterator to which the results table is bound to use the new Iterator
EmpDeptTableIterator.

Click on the EmpSearch,jspx page and In the Structure pane, select the af:table and right-
click Edit Binding.In the Table Binding Editor, use the Select an Iterator drop-down list at
the bottom of the pane to select EmpDeptTableIterator
20) Shuttle all the attributes into the Display Attributes list.
21) Since we are using invokeAction above to force the EmpDeptViewObjIterator to
always be in find mode, we dont need the Find button, which by default would
toggle the form in and out of find mode.
In the Structure pane, expand the panelForm > PanelForm facets > footer
>af:panelGroup > af:panelButtonBar nodes and delete the Find button from the
af:panelForm.

22) Run your EmpSearch page to see results.

Anda mungkin juga menyukai