When using a bean (<jsp:useBean ...>) in a JSP page which extended a class (<%@
page extends="..." %>), I kept on getting a stacktrace which basically said:

.... Method getClassLoader() not found in class ....

in the java file which was generated by the JSP engine in the JSWDK-1.0.  The
class which my JSP page was extending also followed the contract conventions on
page 76 of the JSP 1.0 spec.

The line where it tried to instantiate the Bean declared in the JSP Page was
causing the error.  The actual (generated) line where it was barfing looked
like:

dspHelper = (com.dtai.servlet.util.TestBean) Beans.instantiate(getClassLoader(),
"com.dtai.servlet.util.TestBean");

Now, I got around this by declaring a getClassLoader() method in my class which
implemented HttpJspPage which looked like:

public ClassLoader getClassLoader() {
        return getClass().getClassLoader();
}

But shouldn't the Java file which the JSP engine generates do a
getClass().getClassLoader() when it tries to instantiate the bean automatically?
ie:

dspHelper = (com.dtai.servlet.util.TestBean)
Beans.instantiate(getClass().getClassLoader(),
"com.dtai.servlet.util.TestBean");

In the Java source files generated for JSP's that don't extend another class,
JSP java classes extend HttpJspBase.  Is getClassLoader() a defined method in
that class?

Has anybody else experienced this?

Thanks,
Rich

-------------------------
Richard M. Yumul
mailto:[EMAIL PROTECTED]
DTAI Incorporated
http://www.dtai.com
(619)542-1700 � fax:(619)542-8675

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html

Reply via email to