invalid useBean attribute error

Hey all, I�m having a problem with a .jsp file that I�m trying to view. It�s from a Sun tutorial and has very little modification to it from the way it was posted on Sun�s site. As a matter of fact, I�ve gone so far as to cut and paste the exact code for the .jsp file, and the .java file that it uses, from Sun's website and I still get the same error.

Anyway, the error is �The value for the useBean class attribute deq.CounterBean is invalid.�. And the code for the two files is:

counter.jsp

CounterBean.java

I�ve placed the CounterBean.java file in a folder called �deq� and it sits one level below the counter.jsp file. I did this as a last ditch effort to make the counter.jsp file see the CounterBean.java file.

I also created a BeanTester.java file that uses the CounterBean.java file. This file sits in the same directory as the counter.jsp file and it worked fine.

I�ve placed the CounterBean.java file in a folder called �deq� and it sits one level below the counter.jsp file.

Not correct. Your class hierarchy must be rooted at WEB-INF/classes or be within a jar file in the classpath.

So the correct location (relative to the root of your wen app) would be:

/WEB-INF/classes/deq/CounterBean.class

P.S. I doesn't matter where you put the .java file. It must be compiled and its class file placed as above. The container will not automatically compile it the way that it compiles JSP files. [ October 19, 2004: Message edited by: Bear Bibeault ]

You might want to look into Ant for a great tool to help you build your app; including compiling your java beans, servlets and other classes and placing the resulting .class file in the required locations.

I'm still getting the same error. I tried moving a copy of the WEB-INF directory and all of it's sub folders out of the Tomcat directory as well as simply puting my project into the WEB-INF/classes directory inside Tomcat.

I think I'm going to start reading my new Head First Servlets & JSP book and come back to this after I have a better understanding of JSP.