Saturday, September 7, 2013

Return Value For Bounded Task Flow

Bounded task flow can return a value.Task Flow call activity return value by reference.
Create a task flow that is called as below :

Also see the return value specified

Outcome of the task flow return activity is taskFlowReturn1.
return_called_view1.jsff
<?xml version='1.0' encoding='UTF-8'?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1" xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
  <af:panelGroupLayout id="pgl1">
    <af:button text="button 1" id="b1" action="toView2"/>
  </af:panelGroupLayout>

</jsp:root>
Calling Task Flow is as below 


See the return value specified coming over to the task flow call activity.
return_calling_view1.jsff 
<?xml version='1.0' encoding='UTF-8'?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1" xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
  <af:panelGroupLayout id="pgl1">
    <af:button text="button 1" id="b1" action="toTFCall"/>
  </af:panelGroupLayout>
</jsp:root>
return_calling_view2.jsff 
<?xml version='1.0' encoding='UTF-8'?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1" xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
  <af:panelGroupLayout id="pgl1"/>
  <af:outputText value="test- #{pageFlowScope.retVal1}" id="ot1"/>
</jsp:root>
Click on button and finally see the "Hello World" printed.

Code snippet for the calling task flow 
<task-flow-call id="return_called_tf">
      <task-flow-reference>
        <document>/WEB-INF/return_called_tf.xml</document>
        <id>return_called_tf</id>
      </task-flow-reference>
      <return-value id="__1">
        <name>returnValue1</name>
        <value>#{pageFlowScope.retVal1}</value>
      </return-value>
    </task-flow-call>

Code snippet for the called task flow 

  <task-flow-definition id="return_called_tf">
    <default-activity>return_called_view1</default-activity>
    <return-value-definition id="__1">
      <name>returnValue1</name>
      <value>Hello World</value>
      <class>java.lang.String</class>
    </return-value-definition>

No comments:

Post a Comment