On Mon, 19 Mar 2001, Marc Saegesser wrote:
> I sent this question off into the black hole of
> [EMAIL PROTECTED] but I don't really expect an answer so I'll
> post the question here for discussion.
>
> This question comes a bug (387) against Tomcat-3. The JSP specification
> defines tag names attribute names as containing NMTOKEN values. The
> specification does not define NMTOKEN so I assume that the XML definition
> applies. The XML definition of NMTOKEN allows strings that are not valid
> Java identifiers. Jasper uses tag names to create variable names in the
> generated Java files, so if a tag name contains valid NMTOKEN characters
> (like -, ., and :) then the generated variable name is invalid. It should
> be a fairly straight forward change to Jasper to mangle tag names into valid
> Java syntax.
>
IMHO, the current Tomcat behavior is a Tomcat-specific restriction not
mandated by the spec. We currently choose to generate Java identifiers
based on the name of the tag, but this is not necessary.
However, to get you off the hook :-), I think this is a pretty major
feature change request, and therefore not relevant for 3.2.x. It is an
item of concern for 3.3 and 4.0.
> Attribute names, however, pose a different problem. Attribute names map
> into Java method names and thus can't contain some of NMTOKEN characters.
> Either the specification should define a mapping of NMTOKEN values into Java
> identifers or state that attribute names must be valid Java identifier
> names.
>
It seems to me that Jasper should be using the standard JavaBeans
introspection mechanisms to decide what actual setter method to call
(instead of just gluing "set" on the front of the property name and fixing
the capitalization). If it does so, the tag developer can use a BeanInfo
class associated with their tag to map non-standard property names into
the names of legal getter and/or setter methods.
> For example, the following segment of a tag library descriptor is valid
> according to the specification.
>
> <tag>
> <name>for-each</name>
> <attribute>
> <name>start-index</name>
> </attribute>
> <attribute>
> <name>end-index</name>
> </attribute>
> </tag>
>
>
Craig