Unified Expression Language
Encyclopedia
The Java Unified Expression Language is a special purpose programming language mostly used in Java web applications for embedding expressions into web pages.
The Java
Java (programming language)
Java is a programming language originally developed by James Gosling at Sun Microsystems and released in 1995 as a core component of Sun Microsystems' Java platform. The language derives much of its syntax from C and C++ but has a simpler object model and fewer low-level facilities...

 specification writers and expert groups of the Java web-tier technologies have worked on a unified expression language which is now part of the JSP 2.1
JavaServer Pages
JavaServer Pages is a Java technology that helps software developers serve dynamically generated web pages based on HTML, XML, or other document types...

 specification (JSR-245). While the expression language is part of the JSP specification, it does not depend on the JSP specification and therefore it is available for a variety of technologies.

History

The expression language started out as part of the JavaServer Pages Standard Tag Library (JSTL)
JavaServer Pages Standard Tag Library
The 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, such as XML data processing, conditional execution, loops and internationalization...

 and was originally called SPEL (Simplest Possible Expression Language). It offered a simple way to access data objects. Over the years, the expression language has evolved to include more advanced functionality and it was included in the JSP 2.0 specification, because of the popularity and success in the community.

During the development of JSP 2.0, the JavaServer Faces
JavaServer Faces
JavaServer Faces is a Java-based Web application framework intended to simplify development integration of web-based user interfaces....

 technology was released which also needed an expression language
Expression Language
Expression Language is a scripting language which allows access to Java components 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 ....

, 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 limitation is that its expressions are evaluated immediately. And also, the JSF components need a way to 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).

Features

The new 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

JUEL is an open-source
Open-source software
Open-source software is computer software that is available in source code form: the source code and certain other rights normally reserved for copyright holders are provided under a software license that permits users to study, change, improve and at times also to distribute the software.Open...

 implementation of the Unified Expression Language. It is considered stable and feature complete and is licensed under the Apache License 2.0
Apache License
The Apache License is a copyfree free software license authored by the Apache Software Foundation . The Apache License requires preservation of the copyright notice and disclaimer....

. JUEL is also suitable for use in non-JSP applications.

External links

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK