Forum Moderators: phranque
<jsp:useBean id="converter" class="converters.MyBean" scope="page" >
For some reason, Tomcat cannot find converters.MyBean class
My opening lines of the bean are
package converters;
import java.util.*;
import java.text.*;
public class MyBean {
I have put this everywhere, even declared it in my classpath environment variable.
The JSP (works fine) is defined as a context in the config file. Does my Bean have to be as well?
When the JSP has compiled what is written out for that exact line you have here :
<jsp:useBean id="converter" class="converters.MyBean" scope="page" >
Also if you are sure your configuration files are all correct the only problem I can see is that you have not closed your useBean element off <jsp:useBean id="converter" class="converters.MyBean" scope="page" /> like so! Note: / Also another thing you might want to try is <jsp:useBean id="converter" beanName="MyBean" scope="page" />
beanName - The name of a bean, as you would supply to the instantiate() method in the java.beans.Beans class. This attribute can also be a request time expression.
class - The fully qualified class name.
HTH,
-gs
[edited by: Alternative_Future at 9:45 pm (utc) on June 5, 2003]
The syntax "converters.MyBean" refers to the directory structure. The JSP "package" also refers to the directory. Beans in the same "package" (or directory) can find each other without having further reference.
One other thought - beans need to be in a subdirectory of the WEB-INF/classes path, which you have already by using the converters syntax.