Package javax.servlet.jsp.el
ELResolver
classes that define the
object resolution rules that must be supported by a JSP container
with the new unified Expression Language.See: Description
-
Interface Summary Interface Description FunctionMapper Deprecated As of JSP 2.1, replaced byFunctionMapper
VariableResolver Deprecated As of JSP 2.1, replaced byELResolver
-
Class Summary Class Description Expression Deprecated As of JSP 2.1, replaced byValueExpression
ExpressionEvaluator Deprecated As of JSP 2.1, replaced byExpressionFactory
ImplicitObjectELResolver Defines variable resolution behavior for the EL implicit objects defined in the JSP specification.ScopedAttributeELResolver Defines variable resolution behavior for scoped attributes. -
Exception Summary Exception Description ELException Deprecated As of JSP 2.1, replaced byELException
ELParseException Deprecated As of JSP 2.1, replaced byELException
Package javax.servlet.jsp.el Description
ELResolver
classes that define the
object resolution rules that must be supported by a JSP container
with the new unified Expression Language.
The package also defines programmatic access to the old Expression Language evaluator (pre JSP 2.1).
Please note
that as of JSP 2.1, all classes and interfaces that were in package
javax.servlet.jsp.el
have been deprecated in favor of the new unified
Expression Language APIs (javax.el
). See the Expression Language
specification document for more details.
While a JSP container must still support the deprecated APIs defined
in javax.servlet.jsp.el
, developers should only rely on the
new javax.el
APIs
for new development work.
Two ELResolver classes have been added in JSP 2.1 to implement
object resolution rules that must be supported by a JSP container
with the new unified Expression Language:
ImplicitObjectELResolver
and
ScopedAttributeELResolver
.
Documentation on the old and deprecated API
The JavaServer Pages(tm) (JSP) 2.0 specification provides a portable API for evaluating "EL Expressions". As of JSP 2.0, EL expressions can be placed directly in the template text of JSP pages and tag files.
This package contains a number of classes and interfaces that describe and define programmatic access to the Expression Language evaluator. This API can also be used by an implementation of JSP to evaluate the expressions, but other implementations, like open-coding into Java bytecodes, are allowed. This package is intended to have no dependencies on other portions of the JSP 2.0 specification.
Expression Evaluator
Programmatic access to the EL Expression Evaluator is provided through the following types:ExpressionEvaluator
Expression
FunctionMapper
VariableResolver
An ExpressionEvaluator
object can be obtained from a
JspContext object through the getExpressionEvaluator
method. An ExpressionEvaluator encapsulates the EL processor. An EL
expression provided as a String can then be evaluated directly, or it
can be parsed first into an Expression
object. The parse
step, can be used to factor out the cost of parsing the expression, or
even the cost of optimizing the implementation.
The parsing of an expression string is done against a target type,
a default prefix (that applies when a function has no prefix), and
a FunctionMapper
. The FunctionMapper
object
maps a prefix and a local name part into a
java.lang.reflect.Method
object.
The interpretation or evaluation of a parsed expression is done
using a VariableResolver
object. This object resolves
top level object names into Objects. A VariableResolver
can be obtained from a JspContext
object through the
getVariableResolver
method.
Exceptions
The ELException
exception is used by the expression
language to denote any exception that may arise during the parsing or
evaluation of an expression.
The ELParseException
exception is a subclass of
ELException
that corresponds to parsing errors
Parsing errors are conveyed as exceptions to simplify the API. It is expected that many JSP containers will use additional mechanisms to parse EL expressions and report their errors - a run-time API cannot provide accurate line-error numbers without additional machinery.
Code Fragment
Below is a non-normative code fragment outlining how the APIs can be used.
// Get an instance of an ExpressionEvaluator ExpressionEvaluator ee = myJspContext.getExpressionEvaluator(); VariableResolver vr = myJspContext.getVariableResolver(); FunctionMapper fm; // we don't have a portable implementation yet // Example of compiling an expression. See [ISSUE-2] // Errors detected this way may have higher quality than those // found with a simple validate() invocation. ExpressionCompilation ce; try { ce = ee.prepareExpression(expr, targetClass, fm, null // no prefixes ); } catch (ELParseException e) { log (e.getMessage()); } try { ce.evaluate(vr); } catch (ElException e) { log (e); }
Traduction non disponible
Les API Java ne sont pas encore traduites en français sur l'infobrol. Seule la version anglaise est disponible pour l'instant.
Version en cache
18/09/2025 12:23:33 Cette version de la page est en cache (à la date du 18/09/2025 12:23:33) afin d'accélérer le traitement.Vous pouvez activer le mode utilisateur dans le menu en haut pour afficher la version plus récente de la page.
Document créé le 07/10/2007, dernière modification le 18/08/2025
Source du document imprimé : https://www.gaudry.be/java-api-javaee-rf-javax/servlet/jsp/el/package-summary.html
L'infobrol est un site personnel dont le contenu n'engage que moi. Le texte est mis à disposition sous licence CreativeCommons(BY-NC-SA). Plus d'info sur les conditions d'utilisation et sur l'auteur.
Références
Ces références et liens indiquent des documents consultés lors de la rédaction de cette page, ou qui peuvent apporter un complément d'information, mais les auteurs de ces sources ne peuvent être tenus responsables du contenu de cette page.
L'auteur de ce site est seul responsable de la manière dont sont présentés ici les différents concepts, et des libertés qui sont prises avec les ouvrages de référence. N'oubliez pas que vous devez croiser les informations de sources multiples afin de diminuer les risques d'erreurs.