Reputation: 41
I have deployed the petclinic code from the SPring 3 svn samples repository in Tomcat7 and I get the following exception:
Internal error
Root cause is: /WEB-INF/jsp/owners/form.jsp(4,1) "${owner.new}" contains invalid expression(s): javax.el.ELException: [new] is not a valid Java identifier org.apache.jasper.JasperException: /WEB-INF/jsp/owners/form.jsp(4,1) "${owner.new}" contains invalid expression(s): javax.el.ELException: [new] is not a valid Java identifier
This expression resolves perfectly well in SpringSOurce tc Server Developer Edition 2.0.
Any ideas why Tomcat 7.0.2 has a problem with it?
Upvotes: 4
Views: 2538
Reputation: 1108802
Bozho has ever reported this bug: 50147 - static is not a valid identifier.
It boils down to:
The important part for this discussion is on page 21 (of the EL specification).
Identifier ::= Java language identifierJava language identifier is defined by the Java Language Specification (JLS).
Identifiers are specified in chapter 3.8 of the JLS which indeed confirms that identifiers may not be a keyword. As per the bug report, you need to access it as follows instead:
${owner['new']}
or
${owner.isNew()}
Upvotes: 4
Reputation: 3027
It will work with ${owner.isNew()}
instead of ${owner.new}
.
Upvotes: 0
Reputation: 16625
The EL specification does not permit the use of Java keywords as identifiers. "new" is a Java keyword and hence ${owner.new} is not legal EL. Tomcat 7 enforces this rule by default (Tomcat 6 doesn't for backwards compatibility). The bug is in the Spring sample app.
Upvotes: 2
Reputation: 403501
My guess is that the EL parser in Tomcat 7 is just a bit more strict than that in tcServer (which is based on Tomcat 6).
I suggest filing a bug at http://jira.springsource.org to that effect, it's almost certainly something they'll want to fix.
Upvotes: 1