Monday, 4 February 2013

Create Simple Search form in Oracle ADF

1. Create a New Application
New > Applications > Fusion Web Application (ADF)
Application Name – SearchForm
Directory -- (Jdev install dir)/jdeveloper/(project name)
Application Package Prefix – Demo.adf.searchform





2. Create Test Table and insert data some data in it (For Testing Purpose)
CREATE TABLE xx_search_demo
(    -- ---------------------
     -- Data Columns
     -- ---------------------
     column1                  VARCHAR2(100),
     column2                  VARCHAR2(100),
     -- ---------------------
     -- Who Columns
     -- ---------------------
     last_update_date   DATE          NOT NULL,
     last_updated_by    NUMBER   NOT NULL,
     creation_date          DATE          NOT NULL,
     created_by               NUMBER   NOT NULL,
     last_update_login  NUMBER

INSERT INTO xx_search_demo VALUES (‘val1’, ’val2’, SYSDATE, 0, SYSDATE, 0, 0);
INSERT INTO xx_search_demo VALUES (‘val1’, ’val2’, SYSDATE, 0, SYSDATE, 0, 0);
INSERT INTO xx_search_demo VALUES (‘val3’, ’val4’, SYSDATE, 0, SYSDATE, 0, 0);
INSERT INTO xx_search_demo VALUES (‘val5’, ’val6’, SYSDATE, 0, SYSDATE, 0, 0);


3. Create EO
Right Click on Model > New > ADF Business Components > Entity Object

Package -- Demo.adf.searchform.model.entities
Name – SearchEO
Schema Object – XX_SEARCH_DEMO
Note – By default ROWID will be the primary key if we will not make any column to be primary key in Attribute Settings Page 
Check the Accessors, Create Method, and Remove Method




Check Generate Default View Object CheckBox
Package – Demo.adf.searchform.model.queries
Name – SearchVO
Check Application Module CheckBox
Package –
Name – SearchAM
4. Define Bind Variables
Double Click on SearchVO in Model Project go to query page
Expand the Bind variable accordion and click on Green button

Bind Variable name and type as following make sure required check box is un-checked
Name – Col1
Type -- String
5. Create Named View Criteria
Double Click on SearchVO in Model Project go to query page. Expand the View Crriteria accordion and click on Green button
View Criteria is actually conditions on VOs which you usually define declaratively
     1.      Expand the View Critieria Section in SearchVO page and click the Green plus sign
     2.      Give a proper name to your View Criteria
          Criteria Name -- SearchVOCriteria
     3.      Click on Add Item
           Click the ( ) group press Add item and select values as sown in slide make sure you have selected the bind variable Col1
          Attribute – Column1
          Operator – Equals
          Operand – Bind Variable
          Parameter – Col1
          Un-check Ignore Case and Check Ignore Null Values
6. Create Search Form
Right Click on ViewController > New > Web Tier > JSF > JSF Page
File Name – Search
Initial Page Layout and Content – Quick Start Layout
Click on Browse and select One Column Stretched and check Apply Theme
Expand Page Implementation and Select Automatically Expose UI Components in a New Managed Bean
Select SearchVO and Expand the Data Control panel and Drag and drop the Named View Critieria “SearchVOCriteria” to the page
Choose Query > ADF Query Panel with Table as shown in the slide
The Page would look like this --
7. Refine Layout
Change the Header from “SearchEO” to “Search Demo”. To change select panel Header and change Text property to “Simple Search Demo”
Note - You can change form properties like Column names and page width as per your requirements
8. Congratulation you have successfully finished. Test Your Work Your Simple Search Form is Ready


  1. Thanks for the post, I am following your instructions exactly however I am always getting "No search fields added." in the query panel. Am I missing something?

  2. Hi,
    Thanks for the post.

    How to change the fields labels in the search form. The search form shows the same label in the view object which is not user friendly. for example the in Employee table. Instead of (Fname) I need to have in the label (First Name). Note, I could change the fields names in the table but not in the search form .

  3. Select the Result table, in the Structure Window, select the column and go to properties for that column and change the header Text as per your choice.

  4. Excellent Blog very imperative good content, this article is useful to beginners and real time
    employees.Thank u for sharing...
    Oracle ADF Online Training
    Oracle DBA Online Training
    Oracle APPS Online Training

  5. I really appreciate information shared above. It’s of great help. If someone want to learn Online (Virtual) instructor lead live training in Oracle ADF TECHNOLOGY , kindly contact us
    MaxMunus Offer World Class Virtual Instructor-led training on TECHNOLOGY. We have industry expert trainer. We provide Training Material and Software Support. MaxMunus has successfully conducted 100000+ pieces of training in India, USA, UK, Australia, Switzerland, Qatar, Saudi Arabia, Bangladesh, Bahrain and UAE etc.
    For Demo Contact us.
    Pratik Shekhar
    Ph:(0) +91 9066268701