Friday, January 10, 2014

JSF 2.2.x Expression Language (EL) Delimiting { } in nested EL

Introduction

I was working on possible updates for our application to use JavaServer Faces 2.2 with Manfred Riem from Oracle. I mentioned that I was had tried to update to 2.2.3, but encountered an exception from EL that indicated that the statements were unbalanced. I didn't have time at that point to figure out what the issue was. It was annoying that the switch from 2.1 to 2.2 would cause such an issue, but I thought I would figure it out later. Later arrived...

There is an issue JAVASERVERFACES-2977 : Components get rendered twice we encountered that occurred when we tried to upgrade to 2.1.26. It was fixed in 2.2.5, but needs to be backported to 2.1.x branch. You can get around the issue by using 2.1.21, but Manfred suggested using JSF 2.2. I decided to give it another try, but I am also aware that I am trying to run it on an EE 6 container not EE 7. This is not an issue in the sense that the technology works, but it is not on a support matrix.

Issue

Fast forward, the EL issue appeared again. Manfred and I looked at the issue and it has the following code signature:

"#{abc:method('ABC$XYZ(current{QUANTITY})',bean.property)}"
or this in a more shortened form.
"#{'{}'}"

Manfred and I tried a number of solutions, one of which seemed to work. However, after further examination it failed to work too.
The troubling part is that existing code running on JSF 2.0, and 2.1 on Weblogic worked fine. I began to look a little deeper. I really want our application to run JSF 2.2 on the latest build. I created a simple project to work out how to delimit the EL which was causing a problem. The project can be downloaded below, or in the references section.

Code: jsf-el-delimiting
When I deployed the project to my GlassFish 4.0 server, it worked! I was really surprised. I went back to my modified GlassFish 3.1.2.2 instance which had JSF 2.2.4 running on it. It failed. So I realized that there was an issue introduced between 2.2.0 and 2.2.4. I later checked with 2.2.5 and found the same issue. I began the process of tracking down where the issue began. It looks like it started on 2.2.2.
JSF Version Passed
2.2.0 OK
2.2.1 OK
2.2.2 FAIL
2.2.3 FAIL
2.2.4 FAIL
2.2.5 FAIL

SOLUTION

The interim solution until the JIRA issue listed in the references is resolved, you can use JSF 2.2.0, or 2.2.1 in your project.

References

0 comments :

Popular Posts