Hi,
You shouldn't need to use the viewId of the page from from_b in your
> navigation rule. Instead you should use the ID of the flow-call node in
> flow_a, "callB" in your case. I might even go so far as to say it's a
> bug if the navigation rules in flow_a worked using the viewId from flow_b.
I agree it should be considered as a bug.
I have tried to set instead "callB" but it does not work.
So for the moment I have removed the from-view-id.
I have created a small project on github, inspired from your basic
examples. Here it is:
https://github.com/jaxio/jsf-faces-flow-example
When the flow_b returns, contrary to what I said previously, I loose the
flowScope var instances set before calling flow_b.
Also, note that I could not figure out how to get (from 'flow_a') the
parameter returned by 'flow_b'
I'd like to continue my review/experiment but I am currently stuck. Either
the implementation is incomplete (which I can certainly understand given
the draft nature of the spec) or I am missing something. In the later case,
your help is much appreciated.
As for including navigation cases inside the flow-call element I'm not
> sure I'm keen on the idea. The reason is typically NavigationHandler
> implementations collect all the navigation rules up front and place them
> into an optimal data structure so navigation handling is fast. Having
> navigation cases defined elsewhere that are only valid in a particular
> situation complicates life for the navigation handler.
>
My feedback is done from a user standpoint, not from a JSF implementor.
As a user, it feels (at least to me) much more natural to declare such case
within the call-flow node (xml or java) in order to keep whatever is
related to navigating inside my flow in a single place.
Nicolas.
> Dave
>
>
> On 1/3/2013 4:09 AM, Nicolas Romanetti wrote:
>
> Hello David,
>
> This is clear, thank you. I could make it work but not exactly as you
> answer suggests.
>
> I have tried to use <j:navigation-rule> in the <f:metadata> but apparently
> this tag is not defined and from the Java FlowBuilder, there is no way to
> set any navigation rule.
>
> So I ended up declaring a navigation-rule in the faces-config.xml, as
> follow:
> (note: I changed the flow id from flow-b to flow_b to avoid xsd complaints
> later on)
>
> <navigation-rule>
> <from-view-id>/flow_b/next_b.xhtml</from-view-id>
> <navigation-case>
> <from-outcome>outcomeFromB</from-outcome>
> <to-view-id>/flow_a/next_b.xhtml</to-view-id>
> </navigation-case>
> </navigation-rule>
>
> It worked! When I get back to the calling flow I can see the flowScope
> variable I had set before calling flow_b.
> However, I think it is weird to have to know the view id of the called
> flow.... (here /flow_b/next_b.xhtml)
>
> *I would prefer something more generic (as your response suggests) but I
> could not find how to declare it. I tried this without success (in
> faces-config.xml)
> *
> <navigation-rule>
> * <from-view-id>/flow_a/callB</from-view-id><!-- callB being the
> flow-call id in flow_a -->
> * <navigation-case>
> <from-outcome>outcomeFromB</from-outcome>
> <to-view-id>/flow_a/next_b.xhtml</to-view-id>
> </navigation-case>
> </navigation-rule>
>
>
> *But ideally I would prefer to declare this rule inside the flow-call
> node, for example:*
>
> <j:flow-call id="callB">
> <j:faces-flow-reference>
>
> <j:faces-flow-id>flow_b</j:faces-flow-id>
> </j:faces-flow-reference>
> <j:outbound-parameter>
>
> <j:name>param1</j:name>
> <j:value>param1ValueFromA</j:value>
> </j:outbound-parameter>
> <j:outbound-parameter>
> <j:name>param2</j:name>
>
> <j:value>param2ValueFromA</j:value>
> </j:outbound-parameter>
> * <navigation-case>*
> * <from-outcome>outcomeFromB</from-outcome>*
> * <to-view-id>next_b</to-view-id>*
> * </navigation-case>*
> </j:flow-call>
>
> What do you think?
>
> Nicolas.
>
>
> On Thu, Jan 3, 2013 at 12:28 AM, David Schneider <
> david.schneider_at_oracle.com> wrote:
> >
> > Hi Nicolas,
> >
> > The called flow does not need to know what flow called it. Think of each
> > flow as a graph of nodes and the edges between the nodes are defined by
> the
> > navigation cases.
> >
> > When a flow returns control to a calling flow it also returns an outcome
> > value. The navigation rules/cases in the calling flow are then evaluated
> > using the outcome and id of the flow-call node to determine what comes
> next
> > in the calling flow. You won't see what comes next in the flow-call
> node,
> > you'll need to look at the navigation cases since they're what defines
> the
> > edges in the navigation graph. This allows the caller to navigate to any
> > page or node following the return based on the outcome value.
> >
> > Does that make sense?
> >
> > Dave
> >
> >
> > On 01/02/2013 11:33 AM, nromanetti_at_jaxio.com wrote:
> >>
> >> Hello,
> >>
> >> I am studying the latest JSF2.2 spec and the examples provided here:
> >> https://svn.java.net/svn/mojarra~svn/trunk/test/web-profile/flow/
> >>
> >> I could not find how a calling flow can take the control back once the
> >> called flow returns.
> >>
> >> I am used to Spring Web Flow... So I was expecting something like this.
> >>
> >> In "flow b" definition:
> >> ================
> >>
> >> <j:flow-return id="taskFlowReturn1">
> >> <outbound-parameter>
> >> <name>resultFromFlowB</name>
> >> <value>The returned Value</value>
> >> </outbound-parameter>
> >> </j:flow-return>
> >>
> >> <!-- note that I have not specified any navigation case as I want to
> >> go back to the calling flow (the current spec does not allow this)
> >> From flow B I should not know who called flow-b, I just want to
> >> give the control back... -->
> >>
> >>
> >> In "flow a" definition:
> >> ================
> >>
> >> <j:flow-call id="callB">
> >> <j:faces-flow-reference>
> >> <j:faces-flow-id>flow-b</j:faces-flow-id>
> >> </j:faces-flow-reference>
> >> <j:outbound-parameter>
> >> <j:name>param1</j:name>
> >> <j:value>param1Value</j:value>
> >> </j:outbound-parameter>
> >> <j:outbound-parameter>
> >> <j:name>param2</j:name>
> >> <j:value>param2Value</j:value>
> >> </j:outbound-parameter>
> >>
> >> <j:on-flow-return id="taskFlowReturn1">
> >> <!-- Here I would know that flow-b returned using
> >> the 'taskFlowReturn1' node. Knowning this I could
> >> decide what to do... for example call a
> >> method, select an appropriate node etc..
> >> -->
> >> </j:on-flow-return>
> >> </j:flow-call>
> >>
> >>
> >> I think it is an essential feature, the called flow should not have to
> >> know who called it. And the caller should know what was the exit node
> >> of the called flow.
> >>
> >> I was relying extensively on such feature when using Spring Web Flow +
> >> JSF.
> >>
> >> Am I missing something?
> >>
> >> Hope this helps.
> >>
> >> Nicolas
> >> --
> >> twitter: @nromanetti
> >
> >
>
>
>
> --
> Nicolas Romanetti
> 06 18 65 03 89
> twitter: @nromanetti
> http://www.jaxio.com/
> http://www.springfuse.com/
>
>
>
--
Nicolas Romanetti
06 18 65 03 89
twitter: @nromanetti
http://www.jaxio.com/
http://www.springfuse.com/