JDeveloper 11g – Model based (ViewObject) List of Values and their end-to-end benefit in the web tier

2

In JDeveloper 11g, as another example of declarative productivity, we can add a List of Values definition to an attribute in a ViewObject, indicating that typically that attribute whenever included in for example and ADF Faces page should be implemented with a List Binding in a SelectOne… component such as ListBox, Radio or Dropdownlist or through a List of values. I will demonstrate that new feature in this article, using EMP and DEPT and creating a List of Values for the DeptNo attribute in the EmployeesView. The List of Values should display the Deptno and Department Name values.

We will see how – without any programming and in less than five  minutes – we create a pretty rich JSF page with a List of Values dialog for the Deptno item.

....

As a simple example, let’s specify that the ViewObject EmployeeView should have a lookup attribute for the name of the Department. Double click on the ViewObject and the new VO Editor appears.


 
This style of wizard is also used in the latest BPEL design time – for example the Workflow Task Editor – as well as the ESB editors.
Let’s first add the DeptView to the EmpView. Notice the new join types available – though the full outer join is not yet available. No more (+) to be added in Expert Mode!
 
Now I can click on the green plus sign to add an attribute, or use the Add from Entity button. If I do the latter, I can select one of the attributes in the Entities associated with this ViewObject.


 

Once the attribute has been added, I can bring it up and press the Add a List of Values button.

 

We get a Popup window. I add the DepartmentView to the model. Next I specify two return values: Deptno and Dname – from the List Attributes – and I associate them with the EmployeeView’s attributes Deptno and Dname.
 
Now I can close the LOV editor.


 
I wonder whether this LOV can be seen in the ADF BC Tester. I run the tester to find that out. And lo and behold: you do get to see it in the Tester:


 
That is pretty cool and useful.

Now let’s see how that can be leveraged in the ADF Faces page.

Create a new JSF page, accepting all defaults. Drag and drop the EmployeeView collection from the DataControl palette onto the page, dropping it as a Form.


 
The page is created as follows:
 
Look at the selectOneChoice element created for the Deptno element. Let’s run the page.
 
That was quick!

Alternatively, and even more impressive, we can drag the Deptno attribute as a List of Values element to the page. This will create a new ADF Faces component called inputListOfValues. It displays the list of values as well as handles the return of the selection.


 
Note: this is NOT a popup window, it a floating DIV element. Not only does it look much nicer and less clunky, it also does not get the user into trouble with her popup blocker.

So here we see declarative end-to-end support for List of Values, all the way from the ADF BC definition in the ViewObject to the List of Values or Dropdown List in the Web page.

 

Share.

About Author

Lucas Jellema, active in IT (and with Oracle) since 1994. Oracle ACE Director for Fusion Middleware. Consultant, trainer and instructor on diverse areas including Oracle Database (SQL & PLSQL), Service Oriented Architecture, BPM, ADF, Java in various shapes and forms and many other things. Author of the Oracle Press book: Oracle SOA Suite 11g Handbook. Frequent presenter on conferences such as JavaOne, Oracle OpenWorld, ODTUG Kaleidoscope, Devoxx and OBUG. Presenter for Oracle University Celebrity specials.

2 Comments

  1. Hi lucas,

    im currently working on a 11g project, in this project i use a inputListOfValues in a table, which shows a window with countries,
    when i select one and return to my page, all fields are cleared in the record where i selected a country.

    Do you have any idea what this could be?

    thanx