7 Replies Latest reply: Feb 1, 2013 9:24 AM by Miguel Angel RSS

    Pass parameter betwen modules

    Miguel Angel
      I have a main application with a "login.jsf" and "home.jsf". It also has modules(bounded task flows) created as adf libraries. I am working with my own UIShell and want to pass a parameter from the main application to one of my modules to query some results.

      For example i have a "UserBean " class with the attribute "codInternal" and my security bounded task flow need this parameter to make a query.

      How can i do this?. I am working with JDeveloper

        • 1. Re: Pass parameter betwen modules
          Timo Hahn
          Why don't you use input parameters on the called task flow?

          • 2. Re: Pass parameter betwen modules
            Miguel Angel
            I call my task flow (adf library) with java code:

            public class AdministradorModulos {

            private String taskFlowId;
            private String codInternal;

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

            public String goToModuloSeguridad() {
            taskFlowId = "/WEB-INF/seguridad-task-flow.xml#seguridad-task-flow";
            return null;

            This is my page:

            <af:document title="inicio.jsf" id="d1">
            <af:form id="f1">
            <af:panelSplitter id="ps1">
            <f:facet name="first">
            <af:panelGroupLayout id="pgl1">
            <af:commandButton text=" ir a seguridad" id="cb1"
            <f:facet name="second">
            <af:region value="#{bindings.dynamicRegion1.regionModel}" id="r1"

            How to pass the "codInternal" parameter with java code?

            Edited by: Miguel Angel on 29/01/2013 04:45 PM
            • 3. Re: Pass parameter betwen modules
              You can set the value in a pageFlowScope variable using EL expression. Evaluate using a utility method.
              In the called taskflow as a region, retrieve the value of this pageFlowScope variable as an input parameter.
              See here:

              • 4. Re: Pass parameter betwen modules
                Miguel Angel
                I have done this:

                public String goToModuloSeguridad() {
                taskFlowId = "/WEB-INF/seguridad-task-flow.xml#seguridad-task-flow";

                FacesContext context = FacesContext.getCurrentInstance();
                Application application = context.getApplication();
                TaskFlowDefinition definition = MetadataService.getInstance().getTaskFlowDefinition(tfi);
                Map<String, TaskFlowInputParameter> parameters = definition.getInputParameters();

                for (TaskFlowInputParameter parameter : parameters.values()) {
                String name = parameter.getName();
                String expression = parameter.getValueExpression();

                ValueExpression expressionValue = null;
                ExpressionFactory elFactory = application.getExpressionFactory();
                ELContext elContext = context.getELContext();
                expressionValue = elFactory.createValueExpression(elContext, expression, Object.class);

                Object value = application.evaluateExpressionGet(context, expression, Object.class);
                return null;

                I have defined mi input parameter in the called task flow:

                <task-flow-definition id="seguridad-task-flow">
                <input-parameter-definition id="__1">
                <view id="seguridad">

                In my page of the called task flow I have:

                <af:outputText value="Code is : #{pageFlowScope.cod}" id="ot2"/>

                But the value of the outpuText is not updated.
                • 5. Re: Pass parameter betwen modules
                  Frank Nimphius-Oracle

                  really the easiest way to pass parameters to a task flow (and this works especially well with dynamic regions) is to use a HashMap reference in the task flow binding.

                  - create a managed bean in viewScope on the parent page
                  - create a HashMap property along with getter/setters
                  - in the dynamic task flow binding configure "parametersMap" to point to #{viewScope.yourBean.map} (assuming you have a setMap/getMap method in the bean)

                  Now from the calling application, you change the content o fthe map (best is to call setMap on the managed bean and pass a Hashmap with the input name/value pairs before switching the task flow. This is less code you write and also less error prone.

                  • 6. Re: Pass parameter betwen modules
                    Miguel Angel
                    Ok but how do I retrieve the value on my bean or my page of the called task flow?. As I understand I have to create a hash property in a managed bean in the main application. But How do i get the value in my security task flow(adf library)?.

                    Edited by: Miguel Angel on 31/01/2013 07:00 PM
                    • 7. Re: Pass parameter betwen modules
                      Miguel Angel
                      I have created my hashMap in the managed bean and in the task flow:

                      Task Flow:

                      <taskFlow id="dynamicRegion1" taskFlowId="${viewScope.admModulo.dynamicTaskFlowId}" activation="deferred"

                      Managed Bean:

                      private HashMap params = new HashMap();

                      public void setParams(HashMap params) {
                      this.params = params;

                      public HashMap getParams() {
                      return params;

                      public String goToModuloSeguridad() {
                      taskFlowId = "/WEB-INF/seguridad-task-flow.xml#seguridad-task-flow";
                      params.put("codInternal", "0000030");
                      return null;

                      In the security task Flow i defined my parameter:

                      <input-parameter-definition id="__1">

                      In the jsf page fragment of my security task flow I have:

                      <af:outputText value="Code is : #{pageFlowScope.codInternal}" id="ot2"/>

                      But I can't see the value. The region binding has a partialTrigger of the command button.

                      Edited by: Miguel Angel on 01/02/2013 10:24 AM