仲量联行是外企吗:jsp调用javabean的应用

来源:百度文库 编辑:神马品牌网 时间:2024/04/28 05:44:28
box.jsp<%@ page contentType="text/html;charset=gb2312"%>
<%@ page import="Box"%>
<html>
<body>
<jsp:useBean id="box" class="Box" scope="page">
</jsp:useBean>
<%
box.setLength(10);
box.setWidth(11);
box.setHeight(12);
//out.println("高="+box.getLength()+"<br>");
%>
</body>
</html>

box bean的内容
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 volum()
{
double volumnValue;
volumnValue=length*width*height;
return volumnValue;
}
public double surfaceArea()
{
double surfaceArea;
surfaceArea=length*width*2+width*height*2+height*length*2;
return surfaceArea;
}
}
fang_kr,能不能准确的说一下
<!-box.jsp-->

这是什么意思
那box bean的内容 的容呢

<!-box.jsp-->
<%@ page contentType="text/html;charset=gb2312"%>
<jsp:useBean id="box" class="Box" scope="page"/>
<html>
<body>
<%
box.setLength(10);
box.setWidth(11);
box.setHeight(12);
//out.println("高="+box.getLength()+"<br>");
%>
</body>
</html>