You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2003/09/02 00:47:57 UTC

DO NOT REPLY [Bug 22867] - Tag handlers can't be inner/nested classes

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=22867>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=22867

Tag handlers can't be inner/nested classes

gthb@dimon.is changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|Jasper                      |Jasper 2



------- Additional Comments From gthb@dimon.is  2003-09-01 22:47 -------
It's Jasper2, apparently.

The second error message I got is presumably from this code in
org.apache.jasper.compiler.Parser:

try {
    tagHandlerClass
	= ctxt.getClassLoader().loadClass(tagInfo.getTagClassName());
} catch (Exception e) {
    err.jspError(start, "jsp.error.unable.loadclass", shortTagName,
		 prefix);
}

so "generator" is just the name of my custom tag (which explains why I didn't
find a single hit for "unable to load class generator" in Google or the Apache
Bugzilla :) ... and it makes perfect sense that the classloader didn't find
this nested class by the nonstandard name syntax OuterClass.NestedClass
(instead of the standard OuterClass$NestedClass syntax).

So the point remains that a nested class breaks JSP compilation if given with
the $ syntax, and breaks classloader lookup if given with the . syntax. So
nested classes are not usable as tag handlers, at least as of version 4.1.24.

The root of this problem is that nested classes in Java have different names
at compile time and at runtime. The fix is presumably to add logic to the JSP
source file generation, replacing all dollar signs in tag-handler classnames
with dots.