Question

Is this just an API defined by Java, to be implemented by (say) servers, or the JRE includes the implementation too?

Thing is that I was trying to concatenate two strings using '+' on my JSF page, but it threw NumberFormatException. It seems it was trying to parse my strings using Long.parseLong().

I was surprised to see this package in the stack trace, as I was thought these expressions are Groovy expressions. This certainly doesn't seem to be Groovy but some other EL.

I am using Weblogic server.

Was it helpful?

Solution

It contains Sun's implementation of the javax.el API which is specified by EL specification. This API is part of Java EE, not Java SE. Implementors are required to provide a concrete implementation of the abstract API so that all the API-definied works will be done. Java EE is basically one large abstract specification. The servletcontainers / applicationservers like Weblogic, Tomcat, Glassfish, etc offers the concrete implementations.

As to your actual problem, no, you indeed can't concatenate strings in EL using + operator like that. The + operator in EL assumes the both sides to be a Number, for round numbers that's Long. That's specified in the EL specification.

You can however just use multiple expressions like follows to "concat" strings.

<h:outputText value="#{user.firstName} #{user.lastName}" />
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top