1 4 package xpetstore.web.webwork.action.cart; 5 6 import java.util.Map ; 7 8 9 16 public class UpdateCardAction 17 extends BaseCartAction 18 { 19 21 private String _itemId[]; 22 private int _quantity[]; 23 24 26 29 protected String doExecute( ) 30 throws Exception 31 { 32 Map cart = getCart( ); 33 34 for ( int i = 0; i < _quantity.length; i++ ) 35 { 36 int qty = _quantity[ i ]; 37 38 if ( qty <= 0 ) 39 { 40 cart.remove( _itemId[ i ] ); 41 } 42 else 43 { 44 cart.put( _itemId[ i ], new Integer ( qty ) ); 45 } 46 } 47 48 return SUCCESS; 49 } 50 51 54 public String [] getItemId( ) 55 { 56 return _itemId; 57 } 58 59 62 public int[] getQuantity( ) 63 { 64 return _quantity; 65 } 66 67 71 public void setItemId( String itemId[] ) 72 { 73 _itemId = itemId; 74 } 75 76 80 public void setQuantity( int quantity[] ) 81 { 82 this._quantity = quantity; 83 } 84 } 85 | Popular Tags |