You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by "Waldhoff, Rodney" <rw...@us.britannica.com> on 2001/03/07 23:49:52 UTC

dashes ('-') in custom tag names

Either I'm reading the spec wrong, or Jasper isn't treating these right.

In the JSP 1.1 spec
(ftp://ftp.java.sun.com/pub/jsp/11final-87721/jsp1_1-spec.pdf), Section
5.3.5 notes that the name element under the tag element has the following
model:

 <!ELEMENT name (#PCDATA) >
 #PCDATA ::= NMTOKEN

(The JSP 1.2 describes custom tag names essentially the same way.)

In the XML 1.0 specification, NMTOKEN (name token) is defined by the
following production:

 [7] Nmtoken  ::= (NameChar)+ 
 [4] NameChar ::= Letter | Digit | '.' | '-' | '_' | ':' | CombiningChar |
Extender 

but when I create a custom tag like <eg:foo-bar/>, then Tomcat generates
source code like:

 _jspx_th_eg_foo-bar_0.setPageContext(pageContext);

which of course fails because '-' is not valid in a Java identifier.

(This is with "Tomcat Version 3.2 (final)", I haven't tried it 4.)

Assuming dashes are valid, the fix seems pretty trivial, but am I missing
something?  Should dashes be valid in tag names?  Colons (':')?

 - Rod