Methods may be invoked in
instances just as you would in Java.
This is a marked improvement over
the basic JSF or JSP expression
You can compare or equate values,
and the returned value will be a
23 == person.age
'fala' < 'fido'
You can create objects and invoke
their constructors. Here you create
simple String and Cat objects.
new String('Hello Spring Enterprise
Ternary expressions work as you'd
expect, yielding the value in the
T(java.lang.Math).random() > .5 ?
'She loves me' : 'She loves me not'
The SpEL lets you set and evaluate
variables. The variables can be
installed by the context of the
expression parser, and there are
some implicit variables, such as
#this , which always refer to the root
object of the context.
A very powerful feature inside of
SpEL is the capability to perform
very sophisticated manipulations of
maps and collections. Here, you
create a projection for the list cats .
In this example, the returned value is
a collection of as many elements
being iterated that has the value for
the name property on each cat in the
collection. In this case, cats is a
collection of Cat objects. The
returned value is a collection of