Package org.jdesktop.el
Provides the API for the Unified Expression Language shared by the JSP 2.1 and JSF 1.2 technologies.
The Expression Language (EL) is a simple language designed to satisfy the specific needs of web application developers. It is currently defined in its own specification document within the JavaServer Pages (tm) (JSP) 2.1 specification, but does not have any dependencies on any portion of the JSP 2.1 specification. It is intended for general use outside of the JSP and JSF specifications as well.
This package contains the classes and interfaces that describe and define the programmatic access to the Expression Language engine. The API is logically partitioned as follows:
- EL Context
- Expression Objects
- Creation of Expressions
- Resolution of Model Objects and their Properties
- EL Functions
- EL Variables
EL Context
An important goal of the EL is to ensure it can be used in a variety of environments. It must therefore provide enough flexibility to adapt to the specific requirements of the environment where it is being used.
Class
invalid reference
javax.el.ELContext
Creation of ELContext objects is controlled through
the underlying technology. For example, in JSP, the
JspContext.getELContext() factory method is used.
Some technologies provide the ability to add an
invalid reference
javax.el.ELContextListenerELContext.
Expression Objects
At the core of the Expression Language is the notion of an expression that gets parsed according to the grammar defined by the Expression Language.
There are two types of expressions defined by the EL: value expressions
and method expressions. A
invalid reference
javax.el.ValueExpression"${customer.name}" can be used either
as an rvalue (return the value associated with property name
of the model object customer) or as an lvalue
(set the value of the property name of the model object
customer).
A
invalid reference
javax.el.MethodExpression"${handler.process}" makes it possible to invoke a method
(process) on a specific model object (handler).
All expression classes extend the base class
invalid reference
javax.el.Expressionequals() and
hashCode(). Morevover, each method on these expression classes
that actually evaluates an expression receives a parameter
of class
invalid reference
javax.el.ELContext
Creation of Expressions
An expression is created through the
invalid reference
javax.el.ExpressionFactory
To create an expression, one must provide an
invalid reference
javax.el.ELContextValueExpression) or signature
(MethodExpression).
The ELContext provides the context necessary to parse an expression.
Specifically, if the expression uses an EL function
(for example ${fn:toUpperCase(customer.name)}) or an
EL variable, then
invalid reference
javax.el.FunctionMapperinvalid reference
javax.el.VariableMapperELContext so that EL functions and
EL variables are properly mapped.
Resolution of Model Objects and their Properties
Through the
invalid reference
javax.el.ELResolver
The EL API provides implementations of ELResolver supporting
property resolution for common data types which include
arrays (
invalid reference
javax.el.ArrayELResolverinvalid reference
javax.el.BeanELResolverLists (
invalid reference
javax.el.ListELResolverMaps (
invalid reference
javax.el.MapELResolverResourceBundles (
invalid reference
javax.el.ResourceBundleELResolver
Tools can easily obtain more information about resolvable model objects and their
resolvable properties by calling
method getFeatureDescriptors on the ELResolver. This method exposes objects
of type java.beans.FeatureDescriptor, providing all information of interest
on top-level model objects as well as their properties.
EL Functions
If an EL expression uses a function
(for example ${fn:toUpperCase(customer.name)}), then a
invalid reference
javax.el.FunctionMapperELContext.
The FunctionMapper is responsible to map
${prefix:name()} style functions to
static methods that can execute the specified functions.
EL Variables
Just like
invalid reference
javax.el.FunctionMapperinvalid reference
javax.el.VariableMapper
An EL variable does not directly refer to a model object that can then
be resolved by an ELResolver. Instead, it refers to an EL
expression. The evaluation of that EL expression gives the EL variable
its value.
For example, in the following code snippet
<h:inputText value="#{handler.customer.name}"/>
handler refers to a model object that can be resolved by an EL Resolver.
However, in this other example:
<c:forEach var="item" items="#{model.list}">
<h:inputText value="#{item.name}"/>
</c:forEach>
item is an EL variable because it does not refer directly to a model
object. Instead, it refers to another EL expression, namely a
specific item in the collection referred to by the EL expression
#{model.list}.
Assuming that there are three elements in ${model.list}, this means
that for
each invocation of <h:inputText>, the following information
about item must be preserved in the
invalid reference
javax.el.VariableMapper
:
first invocation: item maps to first element in ${model.list}
second invocation: item maps to second element in ${model.list}
third invocation: item maps to third element in ${model.list}
VariableMapper provides the mechanisms required to allow the mapping
of an EL variable to the EL expression from which it gets its value.
-
ClassDescriptionDefines property resolution behavior on arrays.Defines property resolution behavior on objects using the JavaBeans component architecture.Maintains an ordered composite list of child
ELResolvers.Context information for expression evaluation.An event which indicates that anELContexthas been created.The listener interface for receiving notification when anELContextis created.Represents any of the exception conditions that can arise during expression evaluation.Enables customization of variable and property resolution behavior for EL expression evaluation.Base class for the expression subclassesValueExpressionandMethodExpression, implementing characterstics common to both.The interface to a map between EL function names and methods.Defines property resolution behavior on instances ofList.Defines property resolution behavior on instances ofMap.AnExpressionthat refers to a method on an object.Holds information about a method that aMethodExpressionevaluated to.Thrown when a method could not be found while evaluating aMethodExpression.Thrown when a property could not be found while evaluating aValueExpressionorMethodExpression.Thrown when a property could not be written to while setting the value on aValueExpression.Defines property resolution behavior on instances ofResourceBundle.AnExpressionthat can get or set a value.The interface to a map between EL variables and the EL expressions they are associated with.