You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Rachel Greenham <ra...@enetgroup.co.uk> on 2000/08/11 16:27:32 UTC

ClassLoader in Jsp superclass

I created my own JSP superclass, because I needed to make available
facilities in another servlet to JSP scripts. So I duly implemented the
HttpJspPage interface.

However, when I tried to use beans, where they would be instantiated (eg:
<jsp:useBean id="testbean" scope="request" class="test.TestBean"/>) it
failed with a compilation error, complaining that there was no such method
"getClassLoader()". This, of course, is absolutely true, there isn't. :-)

So I looked into org.apache.jasper.runtime.HttpJspBase and wasn't surprised
to find a protected ClassLoader getClassLoader() method in there, as well as
a companion setClassLoader(ClassLoader). I just copied these into my JSP
superclass and it's all hunky-dory.

... But if that getClassLoader() is so important, surely it should be
defined in the HttpJspPage interface? Failing that, perhaps the JSP
precompiler should default to using getClass().getClassLoader() or
something?

Any thoughts? Am I coming into an old argument? :-}

-- 
Rachel