1
votes

I´m currently testing Java EE 7 with JSF 2.2 ( just for fun ). Especially the new Faces Flow looks really great, but I´ve some troubles getting my PoC working.

Questions: 1. If i call a flow from an other, is it possible to check if the current flow is "invoked" by an other one ?

The only solution i found, is to pass a special parameter to the sub flow

2. If I call a an other flow via flow-call definition inside the -flow.xml ( for instance a flow where i can select a certain user ). How can i pass a return value to the parent flow ( for instance the selected user )

3. Glassfish 4 always complains about, that the flowHandler puts an object into the http sessions, which is not serializable. Is this a bug ? If not does this mean JSF2.2 is not clusterable respectively all open flows will get lost if a cluster node crashes ?

Regards

1
To 3. Found this java.net/jira/browse/JAVASERVERFACES-2908 I think my glassfish uses an older version of JSFurbiwanus

1 Answers

1
votes

Not entirely clear on your requirements for (1) but FacesFlow does provide the flowScope with which You can store pretty much anything you want it's contents are available within the scope of the current flow.

  1. Take for example, you've navigated from flow A into flow B. You now want to navigate from flow B back into flow A and also pass parameters back into flow A. What you need to do in your flow definition file for flow A (the parameter destination flow), define the parameter you want to pass as inbound:

     <inbound-parameter>
        <name>returnParameterFromB</name>
        <value>#{flowScope.returnParameter}</value>
     </inbound-parameter>
    
  2. Define the desired parameter as outbound in the flow config file of the parameter source flow (flow B)

     <outbound-parameter>
        <name>returnParameterFromB</name>
        <value>#{flowB.returnParameter}</value>
     </outbound-parameter>
    
  3. While in flow B, you must have stored the necessary value in the flowScope object either via EL assignment:

     <h:inputText value="#{flowB.returnParameter}"/>
    

    or in the backing @FlowScoped bean:

     FacesContext ctxt = FacesContext.getCurrentInstance();
     Map<Object, Object> currentFlowScope = ctxt.getApplication().getFlowHandler().getCurrentFlowScope();
     currentFlowScope.put("returnParameter","value");