WEB-INF-----classes---Ball.java----com(Ball.class)
ball.java
package com;
public class Ball{
  private String color;
  private float price;
  private float weight;
  private String factory;/*制造商*/
public void setColor(String c){
  this.color=c;
  }
public String getColor(){
 return this.color;
 }
public void setPrice(float p){
 this.price = p;
}
public float getPrice(){
 return this.price;
 }
public void setWeight(float w){
 this.weight=w;
 }
public float getWeight(){
 return this.weight;
 }
public void setFactory(String f){
 this.factory=f;
 }
public String getFactory(){
 return this.factory;
 }
}
ball1.jsp
<%@ page contentType="text/html;Charset=gbk"%>
<html>
<body>
<center>
<font size="20">
<jsp:useBean  id= "ball" class="com.Ball" scope= "session"/>
<%ball.setColor("蓝色");%>
<jsp:setProperty  name="ball"  property= "price"  
value= "528" />
<jsp:setProperty  name="ball"  property= "weight"  
value= "1.02" />
<jsp:setProperty  name="ball"  property= "factory"  
value= "美国" />
篮球的颜色为:
<jsp:getProperty  name= "ball"  property= "color" /><br>
价格为:
<jsp:getProperty  name= "ball"  property= "price" /><br>
重量为:
<jsp:getProperty  name= "ball"  property= "weight" /><br>
产地为:
<jsp:getProperty  name= "ball"  property= "factory" /><br>
<a href="ball2.jsp">点我看看</a>
</font>
</body>
</html>
ball2.jsp
<%@ page contentType="text/html;Charset=gbk"%>
<html>
<body>
<center>
<font size="20">
<jsp:useBean  id= "ball" class="com.Ball" scope= "session"/>
篮球的颜色为:
<%=ball.getColor()%><br>
价格为:
<jsp:getProperty  name= "ball"  property= "price" /><br>
重量为:
<jsp:getProperty  name= "ball"  property= "weight" /><br>
产地为:
<jsp:getProperty  name= "ball"  property= "factory" /><br>
<a href="ball3.jsp">再点我看看</a>
</font>
</body>
</html>
ball3.jsp
<%@ page contentType="text/html;Charset=gbk"%>
<html>
<body>
<center>
<font size="20">
<jsp:useBean  id= "ball" class="com.Ball" scope= "session"/>
篮球的颜色为:
<jsp:getProperty  name= "ball"  property= "color" /><br>
价格为:
<jsp:getProperty  name= "ball"  property= "price" /><br>
重量为:
<jsp:getProperty  name= "ball"  property= "weight" /><br>
产地为:
<jsp:getProperty  name= "ball"  property= "factory" /><br>
这是ball3.jsp的页面
<a href="ball4.jsp">换种方法看一下</a>
</font>
</body>
</html>
 
ball4.jsp
<%@ page contentType="text/html;Charset=gbk"%>
<html>
<body>
<center>
<font size="20">
<jsp:useBean  id= "ball" class="com.Ball" scope= "session"/>
篮球的颜色为:
<%=ball.getColor()%>
<br>
价格为:
<%=ball.getPrice()%><br>
重量为:
<%=ball.getWeight()%><br>
产地为:
<%=ball.getFactory()%><br>
这是ball4.jsp的页面
</font>
</body>
</html>
 
 
 
  
	posted on 2009-05-05 21:04 
鹏凌 阅读(160) 
评论(0)  编辑  收藏  所属分类: 
Java --j2ee