Made a mistake. My Tomcat version is 3.1 running on top of Win98.
The funny thing is even when I have deleted the bean (the class file), the same error is still reported. I believe I have not placed the bean in the correct folder.
At the moment I have placed the jsp and htm files in ..../webapps/root/myjsp.
The java, class files are placed in ...../webapps/root/myjsp/WEB-INF/classes.
My I do any setting to Tomcat to activate the bean?
Here are the files (htm, jsp, java):-
------------------------
<jsp:useBean id="orderedFruit" class="Fruit" />
<jsp:setProperty name="orderedFruit" property="fruitName" value="Mango" />
<jsp:setProperty name="orderedFruit" property="color" value="Orange" />
<jsp:setProperty name="orderedFruit" property="price" value="5.95" />
<jsp:setProperty name="orderedFruit" property="quantity" param="quantity" />
<html>
<body>
<h1>Your
Fruit Order</h1>
<br><br>
Fruit: <jsp:getProperty name="orderedFruit" property="fruitName"/><br>
Color: <jsp:getProperty name="orderedFruit" property="color"/><br>
Price: $<jsp:getProperty name="orderedFruit" property="price"/><br>
Quantity: <jsp:getProperty name="orderedFruit" param="quantity" /><br>
Total: $<%=orderedFruit.getPrice()*orderedFruit.getQuantity() %>
<br>
<p></p>
<a href="Listing12-3.jsp">Return to order form to adjust quantity</a>
</body>
</html>
--------------------------
public class Fruit {
private
String fruitName;
private int quantity;
private String color;
private boolean isCitrus;
private float price;
public String getFruitName(){
return this.fruitName;
}
public void setFruitName(String name){
this.fruitName=name;
}
public int getQuantityInPounds(){
return this.quantity;
}
public void setQuantityInPounds(int quantity){
this.quantity=quantity;
}
public String getColor(){
return this.color;
}
public void setColor(String color){
this.color=color;
}
public float getPrice(){
return this.price;
}
public void setPrice(float price){
this.price=price;
}
public boolean isCitrus(){
return this.isCitrus;
}
public void setCitrus(boolean isCitrus){
this.isCitrus=isCitrus;
}
}
-------------------------------
<html>
<body>
<h1>Fruit Order Form</h1>
Fruit: Mango<br>
Color: Orange<br>
Price Per Pound: $5.95 <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>
-----------------------------
There is also something very weird. Initially I have made a
test jsp page in ..../webapps/test. I delete the folder completely and restarted Tomcat. However when I tried to load the jsp page, it loaded!! Can I delete files in the <tomcat-install>\work folder?