p--m--s

Greenhorn
+ Follow
since Nov 03, 2001
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by p--m--s

May I recommend finding a "used computer book store". Toronto has at least three great ones. Find a book that is 3 years old, pay about $5 cdn, read and enjoy. Also, write to the publisher, and say that the CD is missing. Some publishers take pity and send a brand new book to you, with the newest CD. (It happened to me!).
22 years ago
Thank you. Although it really does not make any sense to me! I removed the capitals from all places that had the word "Quantity". Then I replaced setQuantityInPounds to just setQuantity (same with getQ...). The only conclusion I can gather is that --- there is a direct relationship from the instance variable name (quantity) and the function (set or get), and therefore placing a capital when combining setQuantity and getQuantity seems to work!
22 years ago
JSP
ok. i have isolated the error (property not found) to the line in my .jsp which tries to jsp:getProperty. Trouble is, even if it doesn't SET the property (value), it should at least FIND the property, NO? I have tried using initCap to differeniate the parameter with the property. Still no luck. Here is the source:
Can anyone help?
First: FruitOrder.html
(note: i placed the jsp:useBean thinking it "instances" it here!?
<HTML> <body> <h1>Fruit Order Form</h1>
<jsp:useBean id="orderedFruit" scope="request" class="aPack.Fruit" />
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>
-------------------------------------------
Now--- the Fruit.java (class). has set and get functions
package aPack;
import java.io.*;
public class Fruit {
private String fruitName;
private String color;
private float price;
private int Quantity;
private boolean isCitrus;
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;}
}
--------------------------------------------
and finally the pain/problem: confirm.jsp
<jsp:useBean id="orderedFruit" scope="request" class="aPack.Fruit" />
<jsp:setProperty name="orderedFruit" property="*" />
<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>
------------------i get the error on this next line:
------------------quanity not found (tried with/out capital Q)
Quantity: <jsp:getProperty name="orderedFruit" property="Quantity" /> <br>
Total: <%=orderedFruit.getPrice()*orderedFruit.getQuantityInPounds() %> <p></p>
<a href="FruitOrder.html">Return to order form to adjust quantity</a>
</body>
</html>
<%--
<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" />
--%>
22 years ago
JSP