Faces Flows


Standard Syntax:
     <%@ taglib prefix="j" uri="http://java.sun.com/jsf/flow" %>

XML Syntax:
     <anyxmlelement xmlns:j="http://java.sun.com/jsf/flow" />

Elements for defining faces flows. When these elements are used in VDL views, they must be nested within the <f:metada> section. The meaning of these elements in VDL views is functionally equivalent to the same content in the Application Configuration Resources. Throughout the specification of these elements, the term "faces-config" is equivalent to "Application Configuration Resources".

Usage example

  1. <f:metadata>
  2.  
  3.     <j:faces-flow-definition>
  4.         <j:start-node>router1</j:start-node>
  5.        
  6.         <j:faces-flow-return id="success">
  7.             <j:navigation-case>
  8.                 <j:from-outcome>/complete</j:from-outcome>
  9.             </j:navigation-case>
  10.         </j:faces-flow-return>
  11.         <j:faces-flow-return id="errorOccurred">
  12.             <j:navigation-case>
  13.                 <j:from-outcome>error</j:from-outcome>
  14.             </j:navigation-case>
  15.         </j:faces-flow-return>
  16.        
  17.         <!-- If a customerId was specified then we'll edit it, otherwise create a new customer. -->
  18.         <j:switch id="router1">
  19.             <j:navigation-case>
  20.                 <j:if>#{facesFlowScope.customerId == null}</j:if>
  21.                 <j:from-outcome>create-customer</j:from-outcome>
  22.             </j:navigation-case>
  23.         </j:switch>
  24.        
  25.         <j:view id="create-customer">
  26.             <j:vdl-document>create-customer.xhtml</j:vdl-document>
  27.         </j:view>
  28.  
  29.         <j:view id="maintain-customer-record">
  30.             <j:vdl-document>maintain-customer-record.xhtml</j:vdl-document>
  31.         </j:view>
  32.        
  33.        
  34.         <j:initializer>#{maintainCustomerBean.initializeFlow}</j:initializer>
  35.         <j:finalizer>#{maintainCustomerBean.cleanUpFlow}</j:finalizer>
  36.        
  37.     </j:faces-flow-definition>
  38.  
  39. </f:metadata>

Tag Library Information
Display NameFaces Flows
Version2.2
Short Namej
URIhttp://java.sun.com/jsf/flow
 

Tag Summary
faces-flow-definition

Define a faces flow.

VDL usage

Several conventions apply when using this element in a VDL view, but in all cases, the presence of this element in a VDL view indicates that this view must be considered as a ViewNode of the flow. There are two varieties of usage of this element within VDL views: the "flow defining view" and the "member view". In any given VDL defined view, there must be exactly one flow defining view and zero or more member views.

Identifying the flow defining view

The flow defining view must be the first view in a flow that is encountered during a user's traversal of the application.

If this VDL view resides in a directory whose name is equal to the filename of the VDL view, the directory name is taken to be the id of the flow, and the value of the id attribute of the <faces-flow-definition>, if any, is ignored. If there is no <start-node> defined, it assumed to be the VDL view in which this element appears.

If this VDL view does not reside in a directory, or resides in a directory whose name is not equal to the filename of the VDL view, the id and <start-node> must be explicitly specified.

faces-config usage

The entire flow is defined as child elements, or references to other elements of this element.

start-node

Declare the id of the starting node in the flow graph. The start node may be any of the node types mentioned in the class javadocs for FlowHandler.

VDL usage

This element is optional when used in VDL views. See the element documentation for <faces-flow-definition> for details.

faces-config usage

This element is required when used a in a faces-config.

faces-flow-return

Define a return node in a flow graph.

VDL usage

This element must contain exactly one <navigation-case> element, which must contain exactly one <from-outcome> element.

faces-config usage

The semantics are identical when used in a faces-config.

navigation-case

Define a navigation case for a faces flow. This element is used within <faces-flow-return> and <switch> elements.

The semantics of this element are identical whether it is used in a VDL view or in a faces-config file.

switch

Define a switch node in a flow graph.

VDL usage

This element must contain one or more <navigation-case> elements, each of which must contain exactly one <if> and one <from-outcome> element.

faces-config usage

The semantics are identical when used in a faces-config.

if

The content of this element must be an EL expression that may be invoked when the containing swich is activated. If the expresion returns true, the <from-outcome> sibling elements outcome is used as the id of the node in the flow graph to which control must be passed.

The semantics of this element are identical whether it is used in a VDL view or in a faces-config file.

from-outcome

Define a node id to which control will be passed. The meaning of this element depends on the element in which it resides.

The semantics of this element are identical whether it is used in a VDL view or in a faces-config file.

view

Define a view node in a flow graph.

VDL usage

This element must contain exactly one <vdl-document> element.

faces-config usage

The semantics are identical when used in a faces-config.

vdl-document

Define the vdl-document for the enclosing view.

The semantics of this element are identical whether it is used in a VDL view or in a faces-config file.

initializer

A MethodExpression that will be invoked when the flow is entered.

The semantics of this element are identical whether it is used in a VDL view or in a faces-config file.

finalizer

A MethodExpression that will be invoked when the flow is exited.

The semantics of this element are identical whether it is used in a VDL view or in a faces-config file.