Monday, September 2, 2013

Passing Parameter to a Bounded Task Flow

Parameters can be defined at the task flow call activity or on the the called task flow.
Create a called bounded task flow with parameters as below
inputParam1 can be defined for the task flow as above.Code for param_called_view1,jsff is as below :

<?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="param called view1= #{pageFlowScope.param1}" id="ot1"/>
  </af:panelGroupLayout>

</jsp:root>

Create a calling task flow as shown.
Create an input text field in param_calling_view1.jsff which will be passing to the called bounded task flow through the input parameters .Code for param_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:inputText label="Label 1" id="it1" value="#{pageFlowScope.inputValue}"/>
  </af:panelGroupLayout>
  <af:button text="Submit" id="b1" action="toCalled"/>
</jsp:root>

Drag and drop the calling task flow to a page as a region and run the page. Provide some value to input text component and submit. The value will be passed to the called task flow through input parameters . Note the task flow code snippet for calling and called task flows 

Calling Task Flow :
<task-flow-call id="ParamCalledTF">
      <task-flow-reference>
        <document>/WEB-INF/ParamCalledTF.xml</document>
        <id>ParamCalledTF</id>
      </task-flow-reference>
      <input-parameter id="__6">
        <name>inputParameter1</name>
        <value>#{pageFlowScope.inputValue}</value>
      </input-parameter>
    </task-flow-call>

Called Task flow :

<task-flow-definition id="ParamCalledTF">
    <default-activity>param_called_view1</default-activity>
    <input-parameter-definition id="__2">
      <name>inputParameter1</name>
      <value>#{pageFlowScope.param1}</value>
      <class>java.lang.String</class>
    </input-parameter-definition>
    <view id="param_called_view1">
      <page>/param_called_view1.jsff</page>
    </view>
    <use-page-fragments/>
  </task-flow-definition>


No comments:

Post a Comment