3. The orders list for a user can be retrieved as an SQL query from the
USERORDERS database table. It is a list of order IDs and associated
timestamps and product IDs. Since we have no idea how long this list can
grow for a user, we will use a Java bean called Orders to encapsulate this
information and return the information via the bean through the Session
object.
Let us define what the Orders bean must be able to do now:
  Add an order, which consists of the elements order_id, timestamp, and
product_id
  List all the orders
  Retrieve the timestamp for a particular order_id
  Retrieve the product_id for a particular order_id
So the bean must have at least the following interface:
public class Orders {
public void add(String order_id, String order_timestamp, String
product_id);
public Enumeration orderIDs();
public String productID(String orderID);
public String timestamp(String orderID);
}
We implement the list of order IDs as a vector and use hashtables to store
the order timestamps and product IDs. The Java code for the Orders bean
is presented in Figure 81 on page 106.
Chapter 3. Building the Web server
105




  

Home

About Services Network Support FAQ Order Contact
 

Linux Web Hosting

Our partners:Jsp Web Hosting Unlimited Web Hosting Cheapest Web Hosting  Java Web Hosting Web Templates Best Web Templates PHP Mysql Web Hosting Interland Web Hosting Cheap Web Hosting PHP Web Hosting Tomcat Web Hosting Quality Web Hosting Best Web Hosting  Mac Web Hosting 

Lunarwebhost.net  Business web hosting division of Vision Web Hosting Inc. All rights reserved