Unified Expression Language
   HOME

TheInfoList



OR:

The Jakarta Expression Language (EL; formerly Expression Language and Unified Expression Language) is a special purpose programming language mostly used in
Jakarta EE Jakarta EE, formerly Java Platform, Enterprise Edition (Java EE) and Java 2 Platform, Enterprise Edition (J2EE), is a set of specifications, extending Java SE with specifications for enterprise features such as distributed computing and web serv ...
web applications for embedding and evaluating expressions in web pages. The specification writers and expert groups of the Java EE web-tier technologies have worked on a unified expression language which was first included in the JSP 2.1 specification (JSR-245), and later specified by itself in JSR-341, part of Java EE 7.


History


Origin as JSTL

The expression language started out as part of the
JavaServer Pages Standard Tag Library The Jakarta Standard Tag Library (JSTL; formerly JavaServer Pages Standard Tag Library) is a component of the Java EE Web application development platform. It extends the JSP specification by adding a tag library of JSP tags for common tasks, suc ...
(JSTL) and was originally called SPEL (Simplest Possible Expression Language), then just Expression Language (EL). It was a scripting language which allowed access to
Java Java (; id, Jawa, ; jv, ꦗꦮ; su, ) is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea to the north. With a population of 151.6 million people, Java is the world's List ...
components ( JavaBeans) through JSP. Since JSP 2.0, it has been used inside JSP tags to separate Java code from JSP, and to allow easier access to Java components (than in Java code).


JSP 2.0

Over the years, the expression language has evolved to include more advanced functionality and it was included in the JSP 2.0 specification. Scripting was made easier for web-content designers who have little or practically no knowledge of the core Java Language. This scripting language made JSP a scripting language in the true sense. Before EL, JSP consisted of some special tags like
scriptlet In JavaServer Pages (JSP) technology, a scriptlet is a piece of Java-code embedded in the HTML-like JSP code. The scriptlet is everything inside the tags. Between these the user can add any valid Scriptlet i.e. any valid Java Code. In AppleScr ...
s, expressions etc. within which Java code was written explicitly. With EL the web-content designer needs only to know how to make proper calls to core Java methods. EL was, both syntactically and semantically, similar to
JavaScript JavaScript (), often abbreviated as JS, is a programming language that is one of the core technologies of the World Wide Web, alongside HTML and CSS. As of 2022, 98% of websites use JavaScript on the client side for webpage behavior, of ...
expressions: *there is no typecasting *type conversions are usually done implicitly *double and single quotes are equivalent *object.property has the same meaning as object property'/code> EL also liberated the programmer from having to know the particularities of how the values are actually accessed: object.property can mean (depending on what the object is) either object.get("property") or object.getProperty("property") or object.getProperty() etc.


EL 2.1

During the development of JSP 2.0, the
JavaServer Faces Jakarta Faces, formerly Jakarta Server Faces and JavaServer Faces (JSF) is a Java specification for building component-based user interfaces for web applications and was formalized as a standard through the Java Community Process being part of t ...
technology was released which also needed an expression language, but the expression language defined in the JSP 2.0 specification didn't satisfy all the needs for development with JSF technology. The most obvious limitations were that its expressions were evaluated immediately, and the JSF components could not invoke methods on server-side objects. A more powerful language was created with the following new features: *Deferred expressions, which are not immediately evaluated *Expressions that can set as well as get data *Method expressions, which can invoke methods The new expression language worked well for the purposes of JSF. But developers had problems when integrating the JSP EL with the JSF EL because of conflicts. Because of these incompatibilities, the unified expression language initiative was started to unify these expression languages. As of JSP 2.1, the expression languages of JSP 2.0 and JSF 1.1 have been merged into a single unified expression language (EL 2.1).


EL 3.0

Version 3.0 of the expression language (the unified was no longer deemed necessary) was developed in a JSR independent of the JSP and JSF specifications i
JSR-341
Some new features were added, most notably EL equivalents of Java 8 streams and lambda expressions.


EL 4.0

Version 4.0 was released in on 2020-10-07. The API moved from the javax.el package to the jakarta.el package, as part of the transition from Java EE to Jakarta EE.


Features

The unified EL is a union of the JSP and JSF expression languages. In addition to the features already available in the JSP EL, the unified EL has the following features: *Deferred evaluation *Support for expressions that can set values and expressions that can invoke methods *A pluggable API for resolving expressions


Examples

This shows a simple example of Unified EL being used within a JSTL "c:out" tag: An expression that calls a method with a parameter: $


Implementations


Java Expression Language (JEXL)
is a library intended to facilitate the implementation of dynamic and scripting features in applications and frameworks written in Java. Latest release, Version: 3.2.1, 25 June 2021.
JUEL
is an open-source implementation of the Unified Expression Language (EL), specified as part of the JSP 2.1 standard (JSR-245). It is considered stable and feature complete and is licensed under the Apache License 2.0. JUEL is also suitable for use in non-JSP applications. Latest release, Version 2.2.7, 6 Feb 2014.
Apache Commons EL
is the JSP 2.0 EL interpreter from Apache. Latest release, Version 1.0, 20 Jun 2003. Download links to source and binary are broken.


See also

*
OGNL Object-Graph Navigation Language (OGNL) is an open-source Expression Language (EL) for Java, which, while using simpler expressions than the full range of those supported by the Java language, allows getting and setting properties (through defined ...
– An open source EL used by WebWork (and Struts2). *
MVEL MVFLEX Expression Language (MVEL) is a hybrid dynamic/statically typed, embeddable Expression Language and runtime for the Java Platform. Originally started as a utility language for an application framework, the project is now developed compl ...
– An open source EL used in many Java-based projects.
SpEL
– Spring Expression Language, an open source EL that is part of the
Spring Framework The Spring Framework is an application framework and inversion of control container for the Java platform. The framework's core features can be used by any Java application, but there are extensions for building web applications on top of the ...
. It's mainly used in Spring portfolio projects but because it's technology-agnostic it may be used in other projects.
Ant-Flaka
- Intended to simplify
Ant Ants are eusocial insects of the family Formicidae and, along with the related wasps and bees, belong to the order Hymenoptera. Ants evolved from vespoid wasp ancestors in the Cretaceous period. More than 13,800 of an estimated total of ...
build scripts with the help of EL. *
CEL A cel, short for celluloid, is a transparent sheet on which objects are drawn or painted for traditional, hand-drawn animation. Actual celluloid (consisting of cellulose nitrate and camphor) was used during the first half of the 20th century, bu ...
– An open source EL developed by Google.


References


External links

*
JSR 245: JavaServer Pages 2.1
(article at Sun Developer Network (SDN)

(article at java.net) {{Jakarta EE Java (programming language) Scripting languages