>You are asking for a bean with the class name "Animal", and the JSP compiler 
>and/or runtime >can't find it. I'm guessing you meant to use 
>"org.animal.Animal" here?

<jsp:useBean id="animalBean_1" class="org.animal.Animal" scope="session">

JSP  compiler produce next servlet code:
org.animal.Animal animalBean_1 = new org.animal.Animal();

It's OK without  import directive.

Or 

<%@page import="org.animal.Animal"%>
<jsp:useBean id="animalBean_1" type="Animal" beanName="org.animal.Animal" 
scope="session">

JSP  compiler produce next servlet code:
Animal animalBean_1 = (Animal) 
java.beans.Beans.instantiate(this.getClass().getClassLoader(), 
"org.animal.Animal");

And (ClassLoader) the JSP compiler and/or runtime  can find Animal.class

But:
<%@page import="org.animal.Animal"%>
<jsp:useBean id="animalBean_1" class="Animal" scope="session">

But in this case JSP  compiler produce of different servlet code
Animal animalBean_1  = (Animal) 
java.beans.Beans.instantiate(this.getClass().getClassLoader(), "Animal");

The method instantiate(...,...) does not have a fully qualified name of Animal 
and It's does not work.

And (ClassLoader) the JSP compiler and/or runtime TomCat or GlassFish can't 
find Animal class in /WEB-INF/classes/org/animal/

So, directive <%@page import="org.animal.Animal"%> has no effect here and 
beanName="" or class="" org.animal.Animal" cannot be short.
Only fully qualified class name acceptable.
Maybe it's a bug.

But FAQ writes:
======================
Make sure:

Your bean is packaged in a class.
You have fully qualified your class name (e.g.: com.bar.package.MyClass ) OR
You have imported your class into your jsp (e.g.:  <%@ page 
import="com.bar.package.MyClass"%> )
=======================

> Or do you have a class, Animal, in the default package?

package org.animal;
public class Animal {...}

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to