aspose file tools*
The moose likes JSP and the fly likes invalid useBean attribute error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "invalid useBean attribute error" Watch "invalid useBean attribute error" New topic
Author

invalid useBean attribute error

Chris Staten
Ranch Hand

Joined: Sep 24, 2004
Posts: 101
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.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61232
    
  66

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 ]

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61232
    
  66

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.
Chris Staten
Ranch Hand

Joined: Sep 24, 2004
Posts: 101
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.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61232
    
  66

One thing about web apps is that they must follow a certain pattern in order to work. Making yourself aware of that pattern is probably a great idea.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: invalid useBean attribute error