From JRapid

Jump to: navigation, search

A primary feature of JSP technology version 2.0 is its support for an expression language (EL). An expression language makes it possible to easily access application data stored in JavaBeans components. For example, the JSP expression language allows a page author to access a bean using simple syntax such as ${name} for a simple variable or ${name.foo.bar} for a nested property.

Unlike FPath, EL resolves the expressions getting the information from the database, while FPath has
access only to the information displayed in the form which is much more limited.


JRapid offers a set of functions mapped to be used in EL expressions that allow the developer to make use of the methods generated for every entity's DAO.

Build expressions using the following pattern:

EntityName: daoMethod(parameters)

The currently available DAO methods are:

  • find(Long id): returns the instance of the entity type object with the provided id.
  • findOneBy(String field, Object value): returns the instance of the entity type object that matches the criteria.
  • findAll(): returns a collection of all the instances of the entity type present in the database.
  • findManyBy(String field, Object value): returns a collection of all the instances of the entity type that match the criteria.

To access a property of an entity use the '.' character. Check out the valid EL operators in the reference pages of this article. Use the this keyword to refer to the current object or entity.

JRapid provides some other functions to be used in the EL expressions:

  • String concat(String string1, String string2): concatenates both parameters. Supports only two strings.
  • boolean contains(Collection collection, Object o): returns true if the collection contains o.


  • To access the lastName property of a Person entity with id = 7 we could write the "Person:find(7).lastName" EL expression.
  • You can also use EL to access the name of a Company with the expression "company.name" EL expression.
  • Or access the age of the Owner of a company with the expression "company.owner.age" EL expression.
IMPORTANT: In the last two examples we assumed that the variable "company" existed. 
This is unlikely to happen, generally you would have to pass a parameter to EL expressions.

See also

Retrieved from "http://wiki.jrapid.com/w/EL"
Personal tools