I am trying to use a navigation rule to enter a jsf2.2 flow. The rule works and redirects me to the flow start view; however, i get the following error:
WELD-001303 No active contexts for scope type javax.faces.flow.FlowScoped
This is my navigation rule in the faces-config.xml:
This is my flow definition:
This is my directory structure:
I have no issues if I enter the flow using the following:
<h:link value="Enter Flow" outcome="exampleFlow"/>
Any ideas on how to do enter a flow using a navigation rule?
If you use a navigation case then the NavigationHandler will lookup for a direct match of the <to-view-id> element. If there is one it will not start a new flow unless you define a <to-flow-document-id /> element. Thus the flow context is not initialized.
The most time the flow document id is not defined so it will be empty. But you still need the element in the navigation case. Because the NavigationHandler uses the outcome to determine the flow you need to use the flow-id as outcome for the navigation rule. Since the flow call overwrites the normal navigation the <to-view-id> is not used and the value doesn't matter (but there must be one).
In this case the only advantage of using the navigation rule is that you can use redirect=true.
The first page in the flow is defined as <start-node> in the flow definition. If there is no <start-node> the view with the id of the flow name is called.
If you enter a flow you can't choose the start page individually.