ArticleslgStudy

science

Jakarta Expression Language

Jakarta Expression Language is a science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Jakarta Expression Language rather than just read about it. In short: The Jakarta Expression Language (EL; formerly Expression Language and Unified Expression Language) is a special purpose programming language mostly used in Jakarta EE 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…

Key takeaways

  • Jakarta Expression Language belongs to science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Jakarta Expression Language to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Jakarta Expression Language from memory before moving on to harder problems.

Reference excerpt

The Jakarta Expression Language (EL; formerly Expression Language and Unified Expression Language) is a special purpose programming language mostly used in Jakarta EE 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 (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 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 scriptlets, 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 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'] 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 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 in 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. Part of Jakarta EE 9.

EL 5.0 Version 5.0 was released in on 2022-09-05. Removal of a long deprecated method, clarified ambiguities in the specification, added small usability enhancements. Part of Jakarta EE 10.

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:

${myBean.addNewOrder('orderName')}

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 – An open source EL used by WebWork (and Struts2). MVEL – 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. 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 build scripts with the help of EL. CEL – An open source EL developed by Google.

References

External links Official website JSR 245: JavaServer Pages 2.1 Unified Expression Language (article at Sun Developer Network (SDN) Expression Language Unified Expression Language for JSP and JSF (article at java.net)

Worked examples

Example 1 — a first encounter with Jakarta Expression Language

Start with the simplest possible case. Write down what Jakarta Expression Language claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Jakarta Expression Language before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Jakarta Expression Language ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Jakarta Expression Language

In research
Jakarta Expression Language appears in science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Jakarta Expression Language in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Jakarta Expression Language is common in secondary-school and first-year university syllabi. It links to neighbouring topics Java (programming language), Scripting languages, so understanding it makes those chapters shorter.
In everyday life
Look for Jakarta Expression Language outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Jakarta Expression Language” →

How to study Jakarta Expression Language in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Jakarta Expression Language means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Jakarta Expression Language out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Jakarta Expression Language in simple terms?

The Jakarta Expression Language (EL; formerly Expression Language and Unified Expression Language) is a special purpose programming language mostly used in Jakarta EE web applications for embedding and evaluating expressions in web pages. The specification writers and expert groups of the Java EE w…

Why does Jakarta Expression Language matter?

Because it connects several science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Jakarta Expression Language?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Jakarta Expression Language.

Tags

  • Java (programming language)
  • Scripting languages

Keep exploring