3.4. EL usage

EL is used for many things within a flow, including:

  1. Accessing data provided by the client, such as flow input attributes and request parameters.

  2. Accessing internal data structures such as flowScope.

  3. Invoking methods on Spring beans.

  4. Resolving constructs such as state transition criteria, subflow ids, and view names.

Views rendered by flows typically access flow data structures using EL as well.

Expression types

There are basically two types of expressions in Web Flow.

Standard eval expressions

The first, and most common, type of expression, is the standard eval expression. Such expressions are dynamically evaluated by the EL and should not be enclosed in delimiters like ${} or #{}. For example:

<evaluate expression="searchCriteria.nextPage()" />
				

The expression above is a standard expression that invokes the nextPage method on the searchCriteria variable when evaluated. Attempting to enclose this expression in special eval delimiters like ${} or #{} will result in an IllegalArgumentException.

[Note]Note
We view use of special eval delimiters as redundant in this context, as the only acceptable value for the expression attribute is a single eval expression string.

Template expressions

The second type of expression is a "template" expression. Such expressions allow a mixing of literal text with one or more eval blocks. Each eval block is explictly delimited with the ${} delimiters. For example:

<view-state id="error" view="error-${externalContext.locale}.xhtml" />
				

The expression above is a template expression. The result of evaluation will be a string that concatenates the literal text error- with the result of evaluating externalContext.locale. As you can see, explicit delimiters are necessary here to demarcate eval blocks within the template.

See the Web Flow XML schema for a complete listing of the XML attributes that accept standard expressions and template expressions.