Java Reference
In-Depth Information
</flow-definition>
</faces-config>
Navigation between different views can be done through the
action
attribute of the
tag that will actuate the display of the next view. In this attribute you put the name of
the page to which you want to go after the current page. The following code shows
the contents of the
inscriptionFlow1
view. This view corresponds to the input
form for personal information; it contains a field for entering the name, a button to go
to the next view (
inscriptionFlow2
), and a button to return to the previous view
(
inscriptionFlow
).
<!-- inscriptionFlow1 view -->
<f:view>
<h:form>
<h1>Identification information</h1>
<p>Name : <h:inputText id="name"
value="#{inscriptionFlowBean.name}"
/></p>
<p><h:commandButton value="Next"
action="inscriptionFlow2" /></p>
<p><h:commandButton value="Back"
action="inscriptionFlow" /></p>
</h:form>
</f:view>
To end a flow, just pass to the
action
attribute of the dedicated tag for this action
the ID of the exit point defined in the configuration file (
inscriptionFlowExit
).
And to save data between different views, you must use a Flow-Scoped Managed
Bean. The following code shows the skeleton of the
inscriptionFlowBean
man-
aged bean that we use in our inscription flow:
@Named
@FlowScoped(value="inscriptionFlow")
public class InscriptionFlowBean {
//...