In Tomcat 3.x, if the JSP is in the root directory of the web application, the JSP's servlet is created without a package. This allows beans that aren't in a package to be accessible without further effort.
Tomcat 4.x *always* puts the JSP's servlet in a package, so beans without a package are never accessible automatically. You should add: <%@ page import="FormBean" %> Without this, the Java compiler will assume that FormBean is in the JSP's package, which isn't true. Cheers, Larry > -----Original Message----- > From: Wong, Ken LY [mailto:[EMAIL PROTECTED]] > Sent: Thursday, December 06, 2001 2:34 AM > To: '[EMAIL PROTECTED]' > Subject: JavaBean on Tomcat 4.0 > > > Dear all, > > I'm now trying the tomcat 4.0 and want to use JavaBean, what's > the settings of it? How can I achieve in using this? As I've write > a testing program, which works fine on tomcat 3.2.3, I don't know > why it can't works on tomcat 4.0, below is the error reponse... > > Generated servlet error: > C:\Program Files\Tomcat > 4.0\work\localhost\firstcall\inputValidate_0005fhtml$jsp.java: > 221: Class > org.apache.jsp.FormBean not found. > FormBean formHandler = null; > ^ > > > An error occurred at line: 4 in the jsp file: /inputValidate_html.jsp > > Generated servlet error: > C:\Program Files\Tomcat > 4.0\work\localhost\firstcall\inputValidate_0005fhtml$jsp.java: > 224: Class > org.apache.jsp.FormBean not found. > formHandler= (FormBean) > ^ > > > An error occurred at line: 4 in the jsp file: /inputValidate_html.jsp > > Generated servlet error: > C:\Program Files\Tomcat > 4.0\work\localhost\firstcall\inputValidate_0005fhtml$jsp.java: > 229: Class > org.apache.jsp.FormBean not found. > formHandler = (FormBean) > java.beans.Beans.instantiate(this.getClass().getClassLoader(), > "FormBean"); > ^ > 3 errors > > > FormBean is the bean class that I wrritten. It seems related to > the classpath settings, but I have put the FormBean into... > webapps/app1/WEB-INF/classes/FormBean.class, why it still > doesn't work? What's wrong with it? > > Thanks so much~~~ > > -- > Best regards, > > Ken > > -- > 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]>