autoSuggestBehavior is new addition in oracle ADF 11g used to display suggestedItems in a drop down box for an editable component in webpage based on user input on that. In this post what I am trying to show is an implementation of autoSuggestBehavior. Weblog for the AMIS Technology corner has a very good post for that. I am trying to leverage database persistence with autoSuggestBehavior. Data which is displayed as suggestedItems can be taken from backing bean (we can refer (http://technology.amis.nl/blog/6581/adf-11g-the-native-autosuggest-behavior for that methodology) or we can use data from database tables. In this post I have implemented that.
Below is the output of that implementation.
I have created a SQL script for creating country table and inserting values to that table. Please refer http://www.box.net/shared/g6hm06lbvd for downloading that script.
To achieve this only unlike other ADF projects we need not to create any Entity object, view object, Application Module. We can directly start working on webpage. As discussed earlier autosuggestBehavior shows suggestedItems for editable component in webpage. So we have used an inputText and attach viewscope managed bean procedure to the suggestedItems.
The Procedure is as follows
Used getCountries () procedure is as follows
I have used JDBC connection from managed bean to retrieve all country details. Below procedure is used for that.
Above method shows the Implementation without using any ADF Components like Entity, View, and ApplicationModule. But we can achieve same using a view object named "CountryEntityObjectView" and expose that view in Application Module. So that It will reflect in data control.
After that we need to create an Iterator in Page Definition file like below
Make sure that Its Range Size is Sufficient enough to capture all country names. We need to use this Iterator in our Managed Bean Procedure for suggestedItems (showed in 3rd Screen Shot here) as below
download link for Managed Bean java code is http://www.box.net/shared/or2olv7ftz , for webpage is http://www.box.net/shared/g71rrk6lc2and for page definition file is http://www.box.net/shared/zmpt2fh0ms/