May 26, 2012

Creating a table without data control


It is possible to display data of a collection object in a table format in Oracle ADF. To achieve this, create a managed bean and configure it in adfc-config.xml. Create a jsf page and create a table component as given below. Pass the collection object of managed bean as a value to the table and pass field name of the collection object which is to be displayed, as a value to the column.

<af:table value="#{<bean.collectionObject>}"
                        var="row" rowSelection="single" id="t1">
                <af:column sortProperty="c1"
                           headerText="Value"
                           id="c4">
                  <af:outputText value="#{row.<fieldname>}" id="ot4"/>
                </af:column>
</af:table>

Refreshing a component depend on other

Let us say, I have two combo boxes, one is to display list of countries and another is to display the list of states corresponding to the country selected. Which mean, whenever I select a country from the drop down, the state combo box should refresh automatically with the list of states in the selected state. To implement this in ADF, we have to do below steps.

  • The country list should submit its value whenever it is selected. To do this the below property should set to the country combo box
autoSubmit="true"
<af:selectOneChoice label=" Country" id="soc2" autoSubmit="true" />
  • A listener method needs to be written to get list of stats when country is selected and the method should be set to the country component with the below property
valueChangeListener=”#{bean.method}”
<af:selectOneChoice label=" Country" id="soc2" autoSubmit="true" valueChangeListener=”#{bean.method}”/>
  • Whenever the country is submitted the state component should refresh. To do so, the below property should set to the state component
partialTriggers="soc2"
<af:selectOneChoice label=" State" id="soc3" partialTriggers="soc2" />