I am a beginner learning JSP by myself.I am encountering an error when i am trying to implement JavaBean with JSP.
[B]
This is the error message
An error occurred at line: 15 in the jsp file: /confirm.jsp
Generated servlet error:
C:Documents and Settingsstudent.
symbol : class Fruit
location: class org.apache.jsp.confirm_jsp
Fruit order = null;
I have 3 different programs
[B]
Fruit.Java( which is the bean)
public class Fruit {
public String fname;
public int quantity;
public String color;
public float price;
private String sampleProperty;
public String getfname() {
return this.fname;
}
public void setfname(String name) {
this.fname = name;
}
public int getquantity() {
return this.quantity;
}
public void setquantity(int quantity) {
this.quantity = quantity;
}
public float getPrice() {
return this.price;
}
public void setPrice(float price) {
this.price= price;
}
}
[B]
FruitOrder.html
<html>
<head>
<title>Fruit Order</title>
</head>
<body>
Fruit : Mango<br>
Price per Pound : $5<br>
<form action= “confirm.jsp” method=”post”>
Number of Pounds = <input type= ‘text’ name = “quantity”><br>
<input type=”submit” value=”Order Fruit”>
</form>
</body>
</html>
and [B]confirm.jsp
<jsp:useBean id =”order” class = “Fruit” />
<jsp:setProperty name =”order” property=”fname” value=”Mango” />
<jsp:setProperty name =”order” property=”quantity” param=”quantity” />
<html>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=UTF-8″>
<title> Fruit order</title>
</head>
<h1>JSP Page</h1>
<body>
Fruit : <jsp:getProperty name=”order” property=”fname” />
Quantity : <jsp:getProperty name=”order” property=”quantity” />
Cost : <%=order.getPrice() * order.getQty() %>
</body>
</html>
I know its a very basic program and I am missing one of the silly points..But i have checked and rechecked it ..everything seems to be perfect..I am reakky getting frustrated ..please help before i quit learning ?
Thanks