syidah
02-17-2005, 11:10 PM
hi evrybody...
need ur help.. reagrding shopping cart.. i tried to delete the item in the cart but to still cannot.. there stg wrong w my code.. i reference this code in a book called "Javaserver Pages- fast&easy web development" and still cannot work...
can anyone help..???
below are my codes..
in the java file.. -----------------------------------------------------------
public void removeItem(String id){
System.out.println("\n\n Id = " + id);
Enumeration productEnum = getProducts();
while(productEnum.hasMoreElements()){
Product product = (Product)productEnum.nextElement();
System.out.println("\n\n product id = " + product.getId());
if(product.getId().equals(id)){
System.out.println("\n\n halow product id = " + product.getId());
products.removeElement(product);
}
}
}
---------------------------------------------------------
when i tried this code .. to remove the item 608881 in the cart.. the output is these...
Id = 608881
[2/18/05 8:25:42:870 GMT+08:00] 26190139 SystemOut O
product id = 349
[2/18/05 8:25:42:870 GMT+08:00] 26190139 SystemOut O
product id = 608881
need ur help.. reagrding shopping cart.. i tried to delete the item in the cart but to still cannot.. there stg wrong w my code.. i reference this code in a book called "Javaserver Pages- fast&easy web development" and still cannot work...
can anyone help..???
below are my codes..
in the java file.. -----------------------------------------------------------
public void removeItem(String id){
System.out.println("\n\n Id = " + id);
Enumeration productEnum = getProducts();
while(productEnum.hasMoreElements()){
Product product = (Product)productEnum.nextElement();
System.out.println("\n\n product id = " + product.getId());
if(product.getId().equals(id)){
System.out.println("\n\n halow product id = " + product.getId());
products.removeElement(product);
}
}
}
---------------------------------------------------------
when i tried this code .. to remove the item 608881 in the cart.. the output is these...
Id = 608881
[2/18/05 8:25:42:870 GMT+08:00] 26190139 SystemOut O
product id = 349
[2/18/05 8:25:42:870 GMT+08:00] 26190139 SystemOut O
product id = 608881
