Java Reference
In-Depth Information
within the navigation rules, which will facilitate conditional navigation. Table 2-2 lists the different elements, along
with an explanation of what they do.
As mentioned previously, flow navigation can be specified in XML format by placing it inside an XML file
entitled flowName-flow.xml . Within this file, specify an html element that contains standard JSF taglib
declarations. However, an additional taglib must be declared to enable flow configuration access. The new taglib,
xmlns:j=" " , allows access to those navigational elements listed in Table 2-2 .
The following flow configuration is an example containing flow navigation that using conditional logic:
<?xml version="1.0" encoding="UTF-8"?>
<html xmlns=" "
xmlns:f=" "
xmlns:h=" "
xmlns:j=" " >
<j:switch id="startNode">
<j:flow-return id="exit">
As mentioned previously, flow navigation can also be defined within Java code by utilizing the flow builder API.
To use this technique, create a new Java class that is named the same as the flow identifier, and annotate it with
@FlowDefinition , which will earmark it as a flow definition class. Within the class, a method named defineFlow
should be implemented, which will accept FacesContext and FlowBuilder objects. The FlowBuilder can then be
used to construct the rules for the flow.
import javax.faces.context.FacesContext;
import javax.faces.flow.Flow;
import javax.faces.flow.FlowDefinition;
import javax.faces.flow.builder.FlowBuilder;
import javax.inject.Named;
Search WWH ::

Custom Search