According to EL, the Whatever comes to the right of the dot operator must follow normal Java naming rules for identifiers. For example it must not be a Java Key word (Here the example is shown for int, which is a Java key word). // Java Bean package library; public class Book { private String title; public void setInt(String title) { this.title = title; } public String getInt() { return title; } } // JSP <% library.Book book = new library.Book(); book.setInt("sample title"); request.setAttribute("book", book); %> ${book.int} //OUTPUT sample title
For Tomcat 5, the EL support is provided by commons EL so you'll need to raise a bug in that issue tracker - https://issues.apache.org/jira/browse/EL. Given the lack activity, I doubt it will get fixed. For Tomcat 6/7 Tomcat has a new EL parser implementation. It should be possible to fix this for those versions so I am moving this issue to Tomcst 6.
Thanks for the report. This has been fixed in 7.0.x and will be in 7.0.1 onwards. It has also been proposed for 6.0.x
Reading jsp-2_1-fr-spec-el.pdf (Expression Language Specification Version 2.1, Final Release), 1) page 21: (35/122) "An identifier is constrained to be a Java identifier - e.g., no -, no /, etc." I think that it says nothing about reserved Java keywords. It is just about syntax, not the reserved names. 2) page 15: (29/122) chapter 1.14 ReservedWords has a list of reserved words that is far shorter than the one implemented in r960712
Java identifier is defined by the Java Language Specification and explicitly states keywords are not permitted. The definition is actually even stricter than currently implemented. I'll look at tightening that up.
Created attachment 25726 [details] Patch for 6.0.x Back port of changes to 7.0.x with an additional option to disable the check
Created attachment 25727 [details] Patch for 6.0.x v2 Updated patch
The updated patch has been applied to 6.0.x and will be included in 6.0.30 onwards.
*** Bug 50120 has been marked as a duplicate of this bug. ***
Note, that in 6.0 this check is off by default. One has to set org.apache.el.parser.SKIP_IDENTIFIER_CHECK property to "false" to enable it.
*** Bug 50850 has been marked as a duplicate of this bug. ***
Does not work in 7.0.4
(In reply to comment #11) > Does not work in 7.0.4 Tomcat's 7's behaviour is as per the EL specification although the identifier check can be disabled as a temporary work-around for non-specification compliant applications. If you have any further questions on this, the users list is the place to seek help.
> > If you have any further questions on this, the users list is the place to seek > help. OK, can you point me to the "users list"?
(In reply to comment #13) > OK, can you point me to the "users list"? http://tomcat.apache.org/bugreport.html#Bugzilla_is_not_a_support_forum has the link
*** Bug 51728 has been marked as a duplicate of this bug. ***
I don't know guys, I just ran into the same problem and I'll have to agree with Konstantin on comment 3: both specs 2.1 and 2.2 have that "Reserved Words" section, and neither contains "class" as a keyword. It makes you wonder: "why would both specifications contain that section anyway?" .It seems to me the specification is contradicting itself, so both interpretations might be considered correct. Still this is something I think needs clarification from the JCP. Otherwise be certain that this bug will continue being duplicated over and over again. Just my 2 cents.
The EL specification, Tomcat's implementation, the EL TCK and the EL expert group are all in agreement. EL identifiers must be valid Java identifiers as per the Java language specification. No further clarification is required. The org.apache.el.parser.SKIP_IDENTIFIER_CHECK is provided for non-specification compliant applications but is is strongly recommended that applications fix any bugs that rely on this feature for a work-around.