order = (ItemOrder)itemsOrdered.elementAt(i);
if (order.getItemID().equals(itemID)) {
if (numOrdered <= 0) {
itemsOrdered.removeElementAt(i);
} else {
order.setNumItems(numOrdered);
}
return;
}
}
ItemOrder newOrder =
new ItemOrder(Catalog.getItem(itemID));
itemsOrdered.addElement(newOrder);
}
}
Listing 9.7 Item.java
package coreservlets;
/** Describes a catalog item for on line store. The itemID
* uniquely identifies the item, the short description
* gives brief info like the book title and author,
* the long description describes the item in a couple
* of sentences, and the cost gives the current per item price.
* Both the short and long descriptions can contain HTML
* markup.
*/
public class Item {
private String itemID;
private String shortDescription;
private String longDescription;
private double cost;
Second edition of this book: www.coreservlets.com; Sequel: www.moreservlets.com.
Servlet and JSP training courses by book's author: courses.coreservlets.com.
footer
Our partners:
PHP: Hypertext Preprocessor Best Web Hosting
Java Web Hosting
Jsp Web Hosting
Cheapest Web Hosting
Visionwebhosting.net Business web hosting division of Web
Design Plus. All rights reserved