Quick Expression Language Evaluation

Posted on Updated on

Expression Language (EL) can be very useful but a little fiddly to use. It can be tricky sometimes to work out what a particular piece of EL code will resolve to.

There are a number of tricks to do this, and one way is to create a simple page showing a listing of known-good EL snippets, e.g.

This above example is created using a Page Integration Wizard page with an HTML Markup area added. Then I inserted a quick HTML table to format the elements using the following code for each row:

<tr><td>UserName</td><td>securityContext.userName</td><td>#{securityContext.userName}</td></tr>

You’ll see above that not all EL snippets resolve, and that because the HTML Markup is in a standalone page. It could just as easily be added to an application page temporarily while you fine tune your EL. If it’s placed within an application page you would be able to resolve ELs that take advantage of page bindings and page flow items.