What is an Expression Language (EL)?

Asked

Viewed 3,764 times

3

Widely used in JSF, the famous Expression Languages(EL’s) symbolised by #{}. I don’t know if other languages work the same. What do they mean ?

1 answer

3


Excerpt adapted directly from Oracle’s documentation on Java EE 6:

EL = Expression Language = Expression language:

EL allows the developer to use simple expressions to dynamically access Beans (Javabeans) component data. For example, the "test" attribute of the following tag is filled with an EL expression that compares with the number of session bean items called Cart:

<c:if test="${sessionScope.cart.numberOfItems > 0}">
  ...
</c:if>

Remembering that EL is not exclusive of Java or JSF, you will find EL in several other technologies such as PHP and Angularjs for example.

Javaserver Faces technology uses EL for the following functions:

  • Immediate or late evaluation of expressions;

  • Possibility to set and search Beans data;

  • Possibility to invoke methods;

In short:

EL makes it possible to use simple expressions to communicate screen scripts (XHTML, JSP or others) with the Java code that runs on the server. With this it is possible that we can easily transmit and manipulate data between both layers without having to worry about all the jams that occur between them.

  • In your example you use ${} . Also refers to an EL ?

  • The ${} is precisely the EL applied within the <c:if tag>!

  • Okay, I thought EL only worked with #{} :)

  • EL can be worked in various ways, with Angular2 for example is used {{}}.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.