Tuesday, November 6, 2007

Dynamic Region taskflow with department / employee tree

In JDeveloper 11G is possible to create dynamic region so you can re-use code and save space on your page. This blog explains how to use it with an adf tree on departments and employees. For example if I click in the tree on a department then the departments region is shown and refreshed with the selected department. The same if I click on an employee.

In this example I use a bounded taskflow for employee and one for departmens. How to make this you can see my earlier blog.

Let's drop the department view from the data control and make a adf tree. We also put in the emploview and make sure you select the deptno and empno

Now we can drop a dymamic region by dragging the department task flow on the page. You now got an option to create a dynamic region and jdeveloper gives the option to create a bean. Let's do that. I moved the session backing bean definition to faces-config.xml. Update the backing bean with a key variable and two methods to select the right bounded taskflow region.

public class DepartmentDynamicBean {
private String taskFlowId = "/WEB-INF/task-flow-definition.xml#task-flow-definition";

public DepartmentDynamicBean() {

public TaskFlowId getDynamicTaskFlowId() {
return TaskFlowId.parse(taskFlowId);

public String empRegionLayout() {
// Add event code here...
taskFlowId = "/WEB-INF/task-flow-definition.xml#task-flow-definition";
return null;

public String deptRegionLayout() {
// Add event code here...
taskFlowId = "/WEB-INF/task-flow-definition1.xml#task-flow-definition1";
return null;


Now we can update the adf tree with a switcher so we can put in the right value in the key variable of the bean and call the right method.

The last step is to give the key variable value to the dynamic region so the region can refresh it self with the wanted department of employee.

and we are finished


  1. Hi,

    it was a nice sample but you missed the link to dowonload the workSpace


  2. You can use the other workspace downloads it also contains this example

    thanks edwin

  3. Thank you edwin,
    but with other worspaces the connection is not HR.

    Listen edwin
    I have to implement a tree hierrarchi like in windows-->Workstation-->explorer
    I also have to implement the add and delete action
    Can you give some advice


  4. Ok,

    here is a demo of oracle

    and check this out

  5. Hi Edwin,

    I have a question about the bounded task flow. Can we iterate the bounded task flow execution inside the view. Could you please throw up your thoughts on this?


  6. Hi, Do you mean the flow of the view in a task flow. to control it outside the task flow see this

    or you use a router in the task flow to control the next view. Or a train and skip step by using a backing bean

    thanks Edwin

  7. Thanks Edwin for the quick response.

    I have the following requirement and i am using ADF 11g to build up this.
    Assume an use case "display comment". I am using some rich display to display the comment and allow some functionality on that.
    So i have designed as an bounded taskflow and passing the Comment object as a parameter to the bounded taskflow.

    Now i want to use this bounded taskflow for displaying list of comments inside one page. If the number of comments is fixed then i can design this easily. But the no of comments to be displayed is a runtime variable. So based on the number i would like to call the bounded taskflow. i.e i have an array of the Comment object and i would like to call the bounded takflow for each of them.

    Another way would be, i would have created the bounded taskflow to accept the array of comments object and call the bounded takflow once. However i am thinking this approach in some other places, Basically i would like to call the any bounded takflow dynamically any number of times inside one view.

    Much appreciate if you help me on this.


    - thiva

  8. Hi,

    Ok dynamic bounded taskflow region is it a bit difficult ( maybe impossible ) you have to add the region in the page and add a taskflow executable definition in the pagedef.

    You better have one taskflow and an comment iterator or arraylist as inputparameter of the taskflow then a for each in the pagefragement. in the for each you have a inputtext.

    or you need to add the same taskflow as x regions in the jsf page and use the rendered attribute to control the display of a region when there not so many comments

  9. thanks edwin. Could you please let me know where to download this example from? It would be so helpful.

    thanks again.

  10. Hi

    in this blog you can download the example workspace. it works with the production version of jdev 11g