ADF Faces Dynamic Tags - For a Form that Changes Dynamically

I think this is one of the hidden gems of Oracle ADF - a set of components that can display different data each time.
There is a dynamic form and a dynamic table, both read the meta-data of the component you want them to display and create JSF components on the page to show those at runtime.

The following demo shows the basics of how to use them.
We are creating a method in our Application Module that changes the definition of a view object to be based on a provided SQL statement.
Then we bind that VO to our page using the dynamic Form component.
And voila - you'll give the SQL, we'll show the data...

Two notes:
The vo.executeQuery call in the AM method is redundant in this case. The view will be queried when you navigate to the page without this call also.

Dragging a data control as a dynamic table should result in a code that looks like this in our JSF:

If it doesn't make sure you dropped the right dynamic table. You'll see two options in the drop menu with similar name.You need to choose the "ADF Dynamic Table" one.


Very impressive example. Thank you! Martin

Posted by Martin on October 23, 2010 at 01:55 AM PDT #

Thank you very much! I have a question: If I use a dynamic table instead of a dynamic form how can I select a row and take that value? Thanx for all

Posted by Estefanie Canseco on October 25, 2010 at 10:04 AM PDT #

While it would probably not be as trivial as you can achieve with a normal table, the selectionListener on a dynamic table can still be invoked - and in it you can code your parameter passing.

Posted by shay.shmeltzer on October 26, 2010 at 03:59 AM PDT #

Hi Shay: Thank you for all your help. The dynamic solution worked fine, but I did not use the dynamic table. It was to messy for me. Now I have a different issue: I tried to refactor (change the name) of my aplication module because my client didn't want to keep deafult name (AppModule) and JDeveloper dont do it !!! Can you tell me please if this is a tool bug or simply it can't be done? Thank you again for your support!!!

Posted by Estefanie Canseco on November 10, 2010 at 02:51 AM PST #

Estefanie, I think you are running into bug 9134982 - which is marked as fixed in the next patchset for JDeveloper.

Posted by shay.shmeltzer on November 10, 2010 at 04:24 AM PST #

Oh thank you Shay you save my life once again and I have another question: Is it possible to change the default error messagges that JDeveloper show from DataBase? I have to show a custom messagge for the end-user that a composed primary-key is needeed but I cant change de DataBase messagge. Thank you again for your help!!

Posted by Estefanie Canseco on November 11, 2010 at 08:48 AM PST #

Estefanie, customizing error messages including the ones from the DB is covered in the Fusion Developer Guide

Posted by shay.shmeltzer on November 11, 2010 at 08:55 AM PST #

Thank you very much Shay I promise to send you a StarBucks coffee :P

Posted by Estefanie Canseco on November 11, 2010 at 09:18 AM PST #

hi shay, its a really nice example and which minimize my effort in building dynamic UI, i would be more interested in building an editable UI. Could you please provide some pointers how to build such UI and also i am concerned about the components used in a form layout or a table layout like we are more interested to use choice lists, LOVs rather than simple input texts. please help us with this. Thanks, Sunil.

Posted by sunil on November 29, 2010 at 12:29 AM PST #

hi shay, its a really nice example and which minimize my effort in building dynamic UI. But I am need your help to use this example in a just page fragment ou page, without call another task. How can I do that? Please help us with this. Thanks, DOT

Posted by Dario Toginho on January 17, 2011 at 12:14 AM PST #

Dario, this should basically be the same - you just need to find the right locaiton to write the code that defines the VO - could be button on the page before the page you are showing, could be a phase listener, and could be a method call. Frankly I think using the taskflow approach is best and the clearer way to do this - if you are using a page fragment - it should be inside a taskflow in any case, and then you just add the method call to that taskflow.

Posted by shay.shmeltzer on January 18, 2011 at 03:37 AM PST #

Hi Shay, Thanks a lot for your example. That makes me ask you a question - while acquiring SQL programmatically and using dynamic table can I customize column filters (replace inputText with selectOneChoice) and set column width/stretchColumn?

Posted by ILya Cyclone on March 09, 2011 at 11:59 PM PST #

hi shay, we are also interested about editable dynamic form, would you provide some examples? thanks.

Posted by guest on June 19, 2011 at 01:35 PM PDT #

Guest - for an editable form you'll need to have a VO that is updateable - either by being based on EO or creating a programmatic VO.

Posted by Shay on June 20, 2011 at 07:19 AM PDT #

Hi Shay,
I've followed your example step by step, but when I drop the form from the datacontrol panel onto a jsf page, in the drop box list which appears there's no dynamic form to choose - and yes I did added the dynamic form tag library.

Any suggestion ? I'm running JDeveloper 11g Rel. 2.


Posted by guest on August 03, 2011 at 04:13 PM PDT #

I've solved the issue with dynamic form not shown in the drop list - I had to choose a jspx page and not a jsf facelet.

A question though: how can I call the dynamic form when I click on a table element ?

I try to explain better: I have a table from within different databasetable names appear. I want to click on a table element, get the table name from the clicked row cell, and with that table name, run the dynamic table. Would that possible ? If so, could you explain how to achieve that ?

By the way, very interesting tutorial. Keep on please ;-)


Posted by sergio on August 03, 2011 at 04:27 PM PDT #

hi shay,
can you advise on how to implement usage of createViewObjectOnRowSet()
instead of createViewObjectFromQueryStmt?
I intend to implement dynamic table on PlSql procedure with Cursor Out param.
import java.sql.ResultSet;
ResultSet rset;
vo=this.createViewObjectOnRowSet("v1", (oracle.jbo.RowSet)rset);
//here runtime error occurs
The problem to call vo=this.createViewObjectOnRowSet("v1", (oracle.jbo.RowSet)rset);
is about RowSet proper cast.

Best regards,
Alex Bondarenko

Posted by guest on August 08, 2011 at 06:22 PM PDT #

Alex - you might want to read 42.8.4 How to Create a View Object on a REF CURSOR

Posted by shay on August 09, 2011 at 08:51 AM PDT #

hey Shay,
that is regarding implementing dynamic table on ref cursor.
thank you for the link, it means i've started to dig in the right way, in parallel.

Posted by ebox999 on August 10, 2011 at 02:28 AM PDT #

Hi Shay,

Thanks a lot for the post.
I followed the same procedure and I could create a dynamic read only form. Now, I would like to create a read and write form. That is, the form should be editable and it should post the updated data into the database.
Please help.

Posted by guest on February 14, 2012 at 11:03 PM PST #

guest, for a read/write form you'll need to use another approach - check out this sample/blog -

Posted by Shay on February 16, 2012 at 12:02 PM PST #


I have some questions:

1) When I use makeVO from Your example and generate dynamic table then this table always is read only and I can't insert data using CreateInsert operation. What I need to do to resolve my problem?

2) If I have method parameter displayed in form like input field with value: #{}, how can I say that this value is 180 or read this parameter from other tables row?

3) How can I read value from created dynamic table selected row?

Hope for Your answer soon, regards, Kristaps

Posted by guest on August 31, 2012 at 09:00 AM PDT #

guest - I don't think the dynamic components will answer your need to do an update or select a record.
For those have a look at the forEach based solution shown here:

For question 2 - you can set the NDValue of a parameter in the binding tab to point to any EL you need it including #{'180'}

Posted by Shay on September 05, 2012 at 11:33 AM PDT #

Hi Shay,

when i create ADF Dynamic table in jspx page it is running fine. but when i create it on jsff page as bounded task flow and drag task flow in jspx page as region it given
java.lang.NullPointerException at oracle.adfinternal.view.faces.dynamic.DynamicForm.isRefreshNecessary(

what is the problem i don't understand. please help me.

Posted by Manish Pandey on December 24, 2012 at 11:19 PM PST #

I used your post to create dynamic: table from dynamically created VO.
However the table I got doesn't has sorting or filtering option. How can it be achieved

Posted by Michael Shapira on February 14, 2013 at 05:32 AM PST #

Michael, there is no built in support for sorting since we don't know the structure behind the table. There is however a sortListener on the table - so you should be able to code logic there that will add the sort to your VO and re-execute it. I'm not sure if it will change anything but depending on your use case maybe using the "read only dynamic table option" will make it simpler to implement since you have a column object there.

Posted by Shay on February 14, 2013 at 11:16 AM PST #

I am working on a generic file upload utitlity, and I keep getting the error:
at oracle.adfinternal.view.faces.dynamic.AttributeHelper.getFilteredAttributeDefinitions(

this only happens when i add the row the VO using NameValuePairs and createandInitRow function. If I createrow and insertrow it works fine.
However in the second case I dont get the Entity validations.
Please advice. (i am working with jdev11.


Posted by guest on June 06, 2013 at 04:53 PM PDT #

Hi Shay,

I've created a table with max 6 columns.. Its width is fixed as 90% in CSS file. But when an action takes place like "view only 4 columns" then the extra space is visible.. I want the width of the table to be dynamic according the number of rows I select. Can you please help me with this problem..?

Posted by guest on June 10, 2013 at 03:09 AM PDT #

Hi Shay,

There is panelcollection, inside which am using a table. I've fixed the width of the table in css for max number of columns I want to show. But if the number of columns reduce, extra white space is visible. The width of the table should be dynamic according to the number of columns chosen. Can you please help me with this.


Posted by guest on June 12, 2013 at 11:40 PM PDT #

Hi Shay,

I've to create a page wherein user can enter the query and get the results of the query on the click of an Execute button as you've done here and it has helped me a lot!

I've used createViewObjectFromQueryStmt to create a view object dynamically and implemented a method in my AM that implements this functionality.
I'm getting the results in a dynamic table and displaying them on the page.

But now, i've both the query text box and the table on the same page and i'm having problems in firing multiple queries. The result of first query is displayed perfectly but the second query doesn't fetch any results. The dynamic table still shows attributes from the previous query and doesn't show the new attribute defs related to the new query.

Eg. If i fire select * from EMP; The results are populated into the table perfectly.
But now I fire select * from dept; It shows an error that Emp no. returned NULL, which is an attribute of the EMP table and not department. It still searches for old attribute defs in the new table.

Any help would be highly appreciated.

Posted by guest on March 20, 2014 at 11:24 PM PDT #

i facing problem in calling web service programmatically, I follow all steps of weather app which is available on net,and i create web service over jdeveloper call this by creating web service data control and accessing it in bean using function invokeDataControl.but both times it return me null value in generic type object,
do you have any solution for this.

Posted by Devendra on March 21, 2014 at 05:34 AM PDT #

guest - it depends on what you are actually refreshing You might need to refresh the containing layout component in which the table is - I haven't tried both on the same page.

Posted by guest on March 24, 2014 at 06:23 PM PDT #

I have replicated same thing as shown in the video but i am getting following error:

"Definition Dummy of type Attribute is not found in v1".

Any help would be highly appreciated.

Posted by guest on July 01, 2014 at 10:11 PM PDT #

How can I get a commandLink as a column using af:dynamicComponent?


Posted by David Gress on June 17, 2016 at 04:50 AM PDT #

David - you can't do this with this component - you could use another approach for creating dynamic UI for example:

Posted by Shay Shmeltzer on June 17, 2016 at 09:14 AM PDT #

Post a Comment:
  • HTML Syntax: NOT allowed

I'm a Director of Product Management for Oracle's Cloud Development Tools and Frameworks.
Follow me:

« January 2017