Recently I upgraded my development tomcat from 7.0.0 to 7.0.4. I had things like:
<c:set var="static" value=".." />
<c:set var="class" value=".." />
Both worked on 7.0.0 but stopped working on 7.0.4. I opened a bug, it was closed, with the answer that:
In and of itself, that tag will compile.
The checks for Java identifiers were added to the EL processing so I suspect you have some illegal EL elsewhere on the page.
This didn't sound quite clear, but I didn't get a subsequent answer, so I looked at the EL spec. For the JSP 2.1 (the latest being 2.2) I found that:
Chapter 1, page 21: An identifier is constrained to be a Java identifier - e.g., no -, no /, etc.
And that's the most that I found. I would read this line in a way that the syntax requirements applying to java identifiers apply, but not the reserved words (since neighter class
nor static
appear in the list of reserved words in EL). The JLS isn't referred to for the term "Java identifier" (and it is for some other cases in the 2.2 spec, which I didn't review fully)
So, is Tomcat right to reject these names; which point of the spec they are referring to, and do you think they are interpreting it correctly.
The spec says identifiers are limited to identifiers that would be valid in Java.
Both static
and class
are Java keywords, and so can't possibly be valid identifiers. You couldn't, for example, write this:
public int static = 7;
And so neither static
nor class
will be valid identifiers here either.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With