Bug 50120 - .class in a jsp results in an invalid idetifier
Summary: .class in a jsp results in an invalid idetifier
Status: RESOLVED DUPLICATE of bug 49217
Alias: None
Product: Tomcat 7
Classification: Unclassified
Component: Jasper (show other bugs)
Version: 7.0.2
Hardware: PC All
: P2 normal (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
: 50272 (view as bug list)
Depends on:
Reported: 2010-10-20 04:04 UTC by joker8achtung1
Modified: 2010-11-15 10:57 UTC (History)
1 user (show)


Note You need to log in before you can comment on or make changes to this bug.
Description joker8achtung1 2010-10-20 04:04:38 UTC
when trying to access a getClass() method within a jsp, the following exception occurs:

org.apache.jasper.JasperException: /jsp/example.jsp(68,6) "${memBean.class.name == text}" 
contains invalid expression(s): javax.el.ELException: [class] is not a valid Java identifier

is this a bug or a desired feature of 7.0.2?

as far as i've noticed, the validation is done in org.pache.el.util.Validation whereby invalidIdentifiers contains the class keyword
by the way, validation is done currently case-insensitive, so *.Class.Name would be a work-around
Comment 1 Mark Thomas 2010-10-20 06:39:52 UTC
This is spec required behaviour. Further questions should be addressed to the users mailing list.
Comment 2 Konstantin Kolinko 2010-10-20 06:48:36 UTC
"class" is a reserved word in Java. Note, that you can write your expression as
"${memBean['class'].name == text}"
Comment 3 Mark Thomas 2010-11-15 07:48:45 UTC
*** Bug 50272 has been marked as a duplicate of this bug. ***
Comment 4 Eugene Petrenko 2010-11-15 09:48:01 UTC
This is the breaking change for us to switch to Tomcat7. We have quite a big codebase to search for keyword usages in .jsp/.tag files. Is there a property/parameters/setting to enforce older behavior (like in 6.0) of jsp compiler?
Comment 5 Mark Thomas 2010-11-15 10:51:46 UTC
The same fix has been / will be applied to Tomcat 6.

In the short-term you can use org.apache.el.parser.SKIP_IDENTIFIER_CHECK to bypass the check but that is not a viable long term solution. As time consuming as it may be, you'll need to review your apps for illegal EL and fix any issues.
Comment 6 Konstantin Kolinko 2010-11-15 10:57:23 UTC

*** This bug has been marked as a duplicate of bug 49217 ***