I don't think moving all the pages to the base directory
of your web application is the best solution.  The
important point about:

<jsp:useBean id="formHandler" scope="request" class="MoniBean"/>

is that MoniBean is declared to be in the "default" package,
i.e. it has no package. If you don't declare this fact to the
JSP page, the JSP compiler will assume MoniBean is in the
*same* package as the JSP's java file.

In Tomcat 3.x, the package that JSP's are placed in is equal
to the subdirectory structure from the base of the web
application.  Thus a JSP page in the "jsppages" subdirectory
will be placed in the "jsppages" package.  Hence the error
stating that "Class jsppages.MoniBean not found".  Note the
package name on the class.  Tomcat 3.x's behavior also means
that JSP pages in the base directory of your web application
are placed in the "default" package, causing MoniBean to become
visible by luck.  There is no guarantee about what package
any JSP will be placed in, so you can't count on this.  In
fact, it is guaranteed to not work with Tomcat 4.x.

The best solution is to declare that MoniBean is in the
"default" package rather than allowing the JSP compiler
to assume it is in the same package as the JSP.  To to
this, add:

<%@ page import="MoniBean" %>

This will allow your JSP page to work in any directory and
any servlet container, including Tomcat 4.x.

Cheers,
Larry



> -----Original Message-----
> From: chuck amadi [mailto:[EMAIL PROTECTED]] 
> Sent: Thursday, April 25, 2002 7:22 AM
> To: Tomcat Users List; taglibs-user-help
> Subject: Re: Class jsppages.MoniBean not found. SORTED MYSELF 
> CHEERS ALL
> 
> 
> chuck amadi wrote:
> 
> >
> >            *Hi there any reason for this as i i haven't got 
> jsppages in
> >            my classes path or as a package in my MoniBea*
> >
> >
> >            *<jsp:useBean id="formHandler" scope="request"
> >            class="MoniBean"/>**
> >            **<jsp:setProperty name="formHandler" property="*"/>*
> >            *Error: 500*
> >
> >
> >            *Location: /volapp/jsppages/registerProcess.jsp*
> >
> >
> >            *Internal Servlet Error:*
> >
> > org.apache.jasper.JasperException: Unable to compile 
> > 
> /home/chucka/tomcat/work/DEFAULT/volapp/jsppages/registerProce
> ss_1.java:72: 
> > Class jsppages.MoniBean not found.
> >                    MoniBean formHandler = null;
> >                    ^
> > 
> /home/chucka/tomcat/work/DEFAULT/volapp/jsppages/registerProce
> ss_1.java:75: 
> > Class jsppages.MoniBean not found.
> >                        formHandler= (MoniBean)
> >                                      ^
> > 
> /home/chucka/tomcat/work/DEFAULT/volapp/jsppages/registerProce
> ss_1.java:80: 
> > Class jsppages.MoniBean not found.
> >                              formHandler = (MoniBean) 
> > java.beans.Beans.instantiate(this.getClass().getClassLoader(), 
> > "MoniBean");
> >                                             ^
> > 3 errors
> >
> >     at org.apache.tomcat.facade.JasperLiaison.javac(Unknown Source)
> >     at 
> org.apache.tomcat.facade.JasperLiaison.processJspFile(Unknown 
> > Source)
> >     at 
> org.apache.tomcat.facade.JspInterceptor.requestMap(Unknown Source)
> >     at org.apache.tomcat.core.ContextManager.processRequest(Unknown 
> > Source)
> >     at 
> org.apache.tomcat.core.ContextManager.internalService(Unknown 
> > Source)
> >     at org.apache.tomcat.core.ContextManager.service(Unknown Source)
> >     at 
> > 
> org.apache.tomcat.modules.server.Http10Interceptor.processConn
> ection(Unknown 
> > Source)
> >     at 
> org.apache.tomcat.util.net.TcpWorkerThread.runIt(Unknown Source)
> >     at 
> > 
> org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(Unknown 
> > Source)
> >     at java.lang.Thread.run(Thread.java:498)
> >
> > Please help as i have had to to do a reinstall of tomcat 3.3a as i 
> > couldn't sort the behaviour issue as i kept
> > getting cannot creat Bean.So thid is better than the 
> previous errors.
> >
> > Cheers Chuck Amadi
> > Systems Programmer
> >
> Gathered all my jsp's and htm and placed them in the same 
> level as my webapp
> Cheers Chuck Amadi
> 
> Systems Programmer
> Rhaglennydd Systemau
> 
> >
> 
> 
> 
> 
> 
> --
> To unsubscribe:   <mailto:[EMAIL PROTECTED]>
> For additional commands: <mailto:[EMAIL PROTECTED]>
> Troubles with the list: <mailto:[EMAIL PROTECTED]>
> 

--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>

Reply via email to