Home » Java » Enterprise Java » ADF Declarative Component example

About Eugene Fedorenko

Eugene Fedorenko

ADF Declarative Component example

In my previous post I promised to show  how to create ADF Declarative Component for Smart List Of Values. So, I’m going to create a component consisting of three elements: a label, an input text and a combobox list of values. That’s very easy. I created a separate ADF ViewController project in my work space:


In this project open the Create JSF Declarative Component wizard:

The new declarative component smartLovDef should have at least three attributes: some string for label, attribute binding for input text and LOV binding for combobox list of values:

The wizard creates metadata file declarativecomp-metadata.xml and smartLovDef.jspx file where we can put the content of our component:

The source code of smartLovDef.jspx looks like this:

<?xml version='1.0' encoding='UTF-8'?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
  <jsp:directive.page contentType="text/html;charset=UTF-8"/>
  <af:componentDef var="attrs" componentVar="component">
 <af:panelLabelAndMessage label="#{attrs.label}" id="plam1">
  <af:panelGroupLayout id="pgl1" layout="horizontal">
    <af:inputText value="#{attrs.attrBinding.inputValue}"
                  id="deptid" partialTriggers="departmentNameId"
                 autoSubmit="true" simple="true"/>
    <af:inputComboboxListOfValues id="departmentNameId"
                popupTitle="Search and Select: #{attrs.lovBinding.hints.label}"

      <component xmlns="http://xmlns.oracle.com/adf/faces/rich/component">

The next step is to deploy the component into ADF Library. We have to add new deployment profile for the CSComponents project:

And let’s deploy the project into library:

The following step is to define File System connection in the resource palette to the deployment path of CSComponents project:

After that we have to choose the project where we’re going to use the new component (in my case ViewConroller) and add CSComponents.jar library to it:

Now we can use smartLovDef  component in our page and drag it from the component palette:

In our jspx page the source code is going to look like this:

    <cscompLib:smartLovDef label="#{bindings.DepartmentId.label}"

Reference: ADF Declarative Component example from our JCG partner Eugene Fedorenko at the ADF Practice blog.

(0 rating, 0 votes)
You need to be a registered member to rate this.
Start the discussion Views Tweet it!
Do you want to know how to develop your skillset to become a Java Rockstar?
Subscribe to our newsletter to start Rocking right now!
To get you started we give you our best selling eBooks for FREE!
1. JPA Mini Book
2. JVM Troubleshooting Guide
3. JUnit Tutorial for Unit Testing
4. Java Annotations Tutorial
5. Java Interview Questions
6. Spring Interview Questions
7. Android UI Design
and many more ....
Email address:

Leave a Reply

Be the First to Comment!

Notify of