JSF Tip #57 - Using a different start node in Faces Flows

By convention in Faces Flows the page that is the start node has the same name as the flow, but is it possible to change that? It sure is, read on!

We'll dive into the Faces configuration file that will make this work.


    <faces-config version="2.2"
                  xmlns="http://xmlns.jcp.org/xml/ns/javaee"
                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                  xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee 
                    http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_2.xsd">
        <flow-definition id="indexflow">
            <start-node>index</start-node>
            <view id="index">
                <vdl-document>/indexflow/index.xhtml</vdl-document>
            </view>
            <flow-return id="indexFlowReturn1">
                <from-outcome>/exit</from-outcome>
            </flow-return>
        </flow-definition>
    </faces-config>
        

In the configuration file above you see the start-node is defines as 'index' and then the next XML element defines a view with the name of 'index' and then refers to a vdl-document, that VDL document is a reference to the actual page that is going to be the start-node.

This is all you need to define a different start-node.

Posted February 6, 2014

Up