调用文件(在目录Tomcat 5.5\webapps\ROOT下的JavaBeanTest.jsp)<%@ page contentType="text/html;charset=GB2312" %>
<HTML>
<BODY>
<jsp:useBean id="box" class="first.Box" scope="page">
</jsp:useBean>
<%
 Box.setLength(10);
 Box.setWidth(11);
 Box.setHeight(12);
 out.println("在JSP中使用JavaBean<br/>");
 out.println("盒子的长度为:"+Box.getLength()+"<br/>");
 out.println("盒子的宽度为:"+Box.getWidth()+"<br/>");
 out.println("盒子的高度为:"+Box.getHeight()+"<br/>");
 out.println("盒子的容积为:"+Box.volumn()+"<br/>");
 out.println("盒子的表面积为:"+Box.surfaceArea()+"<br/>");
%>
</BODY>
</HTML>
javabean文件(在Tomcat 5.5\webapps\ROOT目录下的Box.java)package first;
 public class Box
{
   double length;//长
   double width;//宽
   double height;//高
   public Box()
   {//构造函数
     length=0;
     width=0;
     height=0;
   }
   public void setLength(double length)
   {//设置长
     this.length=length;
   }
   public double getLength()
   {//得到长
     return length;
   }
   public void setWidth(double width)
   {//设置宽
     this.width=width;
   }
   public double getWidth()
   {//得到宽
     return width;
   }
   public void setHeight(double height)
   {//设置高
     this.height=height;
   }
   public double getHeight()
   {//得到高
     return height;
   }
   public double volumn()
   {//求容积
     double volumnValue;
     volumnValue=length*width*height;
     return volumnValue;
   }
   public double surfaceArea()
   {//求表面积
     double surfaceAreaValue;
     surfaceAreaValue=length*width*2+width*height*2+height*length*2;
     return surfaceAreaValue;
   }
}生成的类文件放在\Tomcat 5.5\webapps\ROOT\WEB-INF\classes目录下不管用什么样的办法,错误一直显示如下:
org.apache.jasper.JasperException: /JavaBeanTest.jsp(4,0) The value for the useBean class attribute first.Box is invalid.
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:512)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
重启过很多次服务器了,但是总解决不了问题,请问是不是web.xml这个文件没设置啊,我都没改过这东西.
或许唯一的可能就是这个没配置,如果是请问各位应该怎么弄.谢谢帮忙