org.apache.jasper.JasperException: Cannot find any information on property 'price' in a bean of type 'com.wrox.cars.CarBean'
JSP WEB 编程指南里面说
<jsp:getProperty name="myCar" property="price" /> 可以用对任何变量,结果报错。。。待解决..... 代码都是抄过来的
1。在java中加入变量定义,结果说在bean中已经定义了...编译不了
2。jsp页面刷新2次,一次是Unable to load class for JSP,另外一次是Cannot find any information on property 'price' in a bean of type 'com.wrox.cars.CarBean'
3.超级无语,把书配的代码编译运行 还是一样的错误,新手自学真恼火啊
JSP WEB 编程指南里面说
<jsp:getProperty name="myCar" property="price" /> 可以用对任何变量,结果报错。。。待解决..... 代码都是抄过来的
1。在java中加入变量定义,结果说在bean中已经定义了...编译不了
2。jsp页面刷新2次,一次是Unable to load class for JSP,另外一次是Cannot find any information on property 'price' in a bean of type 'com.wrox.cars.CarBean'
3.超级无语,把书配的代码编译运行 还是一样的错误,新手自学真恼火啊
<html>
<head>
<title>Using a JavaBean </title>
</head>
<body>
<h2>Using a javaBean</h2>
<jsp:useBean id="myCar" class="com.wrox.cars.CarBean" />
我有一辆 <jsp:getProperty name="myCar" property="make"/> <br/>
<jsp:setProperty name="myCar" property="make" value="Ferrai" />
现在我又一辆<jsp:getProperty name="myCar" property="make" />
我的车花费:<jsp:getProperty name="myCar" property="price" />
</body>
</html>
package com.wrox.cars;
import java.io.Serializable;
public class CarBean implements Serializable
{
public CarBean() {}
private String make="Ford";
public String getMake()
{
return make;
}
public void setMake(String make)
{
this.make=make;
}
private double cost=1000.00;
private double taxRate=17.5;
public double getPrice()
{
double price =(cost+(cost*(taxRate/100)));
return price;
}
private void setPrice(double newPrice)
{ }