tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Konstantin Kolinko <>
Subject Re: svn commit: r1140383 - in /tomcat: tc5.5.x/trunk/STATUS.txt tc6.0.x/trunk/STATUS.txt
Date Tue, 28 Jun 2011 10:38:02 GMT
2011/6/28 Mark Thomas <>:
> On 28/06/2011 01:08, wrote:
>> Modified: tomcat/tc6.0.x/trunk/STATUS.txt
>> URL:
>>    +1: markt, schultz
>> -  -1:
>> +  -1: kkolinko: 1) It would be OK if it were mangling only reserved words
>> +    (where the tag wouldn't compile previously, so there were no regressions),
>> +    but JspUtils.makeJavaIdentifier() mangles '_' character, which will break
>> +    code that was previously working. E.g. <%=hello_world%>
>> +    2) Maybe it would be better to prefix the names with [_]jsp_ and use some
>> +    numbered suffix, to never collide with names that people may use in their
>> +    code.
> I don't see anything in the JSP specification that says tag file
> attributes must be exposed as Java variables with the same name. Given
> that a tag file attribute can have any name valid in XML, that
> requirement would be impossible to meet since may of those names would
> be invalid as Java identifiers.
> There is a requirement to expose attributes (with the same name) as page
> scoped variables. If I switch the test case to use ${hello_world} rather
> than <%=hello_world%> it works. However, that causes it's own set of
> problems when a Java keyword is used as an attribute name due to the
> restrictions of the EL specification.
> AFAICT, the only solution that is guaranteed (by the specification) to
> work for any attribute name in a tag file is:
> ${pageScope['attributename']}
> Unless I have missed something in the specification (always a
> possibility) that anything else works is a fortunate side-effect of the
> implementation.

Interesting. Though I used this feature a lot, since TC 5.5.

Eclipse IDE used to hilite these usages in red several years ago, but
nowadays it has support for such usage.

> On this basis, I think the new behaviour is compliant with the
> specification.

There is one more problem: you cannot introduce new variables that
will be seen by user's code, unless those are prefixed with reserved
prefix of "jsp_" ( "_jsp_") per JSP.9.1.2. That is because someone can
declare a local variable with the same name.

> That said, I take the point regarding regressions. I'm sure lots of
> folks will have used <%=attributeName%> or ${attributeName} as a
> shortcut although I don't currently see anything to support that usage
> in the JSP specification.

Best regards,
Konstantin Kolinko

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message