Đang chuẩn bị liên kết để tải về tài liệu:
Java Server Pages: A Code-Intensive Premium Reference- P13

Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ

Java Server Pages: A Code-Intensive Premium Reference- P13:Before you begin reading Pure JSP Java Server Pages, you might want to take a look at its basic structure. This should help you outline your reading plan if you choose not to read the text from cover to cover. This introduction gives you an overview of what each chapter covers. | public ShoppingCart Add a new item to the shopping cart. attributes itemId - the unique key associated with the item desc - a text description of the item price - the unit price for this item quantity - number of this item to insert into the shopping cart public void addItem String itemId String desc float price int quantity String item itemId desc Float.toString price Integer.toString quantity if items.containsKey itemId String tmpItem String items.get itemId int tmpQuant Integer.parseInt tmpItem 3 quantity tmpQuant tmpItem 3 Integer.toString quantity else - 121 - items.put itemId item Remove an item from the shopping cart. attributes itemId - the unique key associated with the item to be removed public void removeItem String itemId if items.containsKey itemId items.remove itemId Change the quantity of a specific item in the shopping cart. The item must have previously been added to perform this function. attributes itemId - unique key for the item to be updated quantity - the new quantity to be stored in the shopping cart public void updateQuantity String itemId int quantity - 122 - if items.contains itemld String tmpltem String items.get itemld tmpltem 3 Integer.toString quantity Get an Enumeration to the list of items in the shopping cart. public Enumeration getEnumeration return items.elements Get the total cost of all of the items currently in the shopping cart. public float getCost Enumeration enum items.elements String tmpltem float totalCost 0.00f while enum.hasMoreElements tmpltem String enum.nextElement totalCost lnteger.parselnt tmpltem 3 Float.parseFloat tmpltem 2 - 123