java在src下的mathBox包里,jsp在WebRoot下,
java: 
package mathBox;public class Box {
double length; double width; double height; public Box() {
length = 0;
width = 0;
height = 0;
} public double getHeight() {
return height;
} public void setHeight(double height) {
this.height = height;
} public double getLength() {
return length;
} public void setLength(double length) {
this.length = length;
} public double getWidth() {
return width;
} public void setWidth(double width) {
this.width = width;
}
public double volumn(){
double volumnValue;
volumnValue=length*width*height;
return volumnValue;
}
public double surfaceArea(){
double surfaceArea;
surfaceArea=length*width*2+length*height*2+width*height*2;
return surfaceArea;
}
}jsp:
<%@ page language="java" import="java.util.*" pageEncoding="GB2312"%>
<%@ page import="mathBox.Box"%>
<html>
<body>
<jsp:useBean id="box" calss="mathBox.Box" scope="session">
</jsp:useBean>
<jsp:setProperty name="box" property="length" value="10"/>
<jsp:setProperty name="box" property="width" value="11"/>
<jsp:setProperty name="box" property="height" value="12"/>
盒子的长度为:<jsp:getProperty name="box" property="length"/>
盒子的宽度为:<jsp:getProperty name="box" property="width"/>
盒子的高度为:<jsp:getProperty name="box" property="height"/>
<%
out.print("盒子的容积为:'+box.volumn()+'<br>");
out.print("盒子的面积为:'+box.surfaceArea()+'");
 %>
</body>
</html>运行后报错:
严重: Servlet.service() for servlet jsp threw exception
org.apache.jasper.JasperException: /JavaBeanJsp.jsp(5,2) UseBean has invalid attribute: calss