1 4 package xpetstore.web.webwork.action.cart; 5 6 import java.util.Map ; 7 8 9 16 public class AddItemAction 17 extends BaseCartAction 18 { 19 21 private String _itemId; 22 23 25 28 protected String doExecute( ) 29 throws Exception 30 { 31 Map cart = getCart( ); 32 Integer qty = ( Integer ) cart.get( _itemId ); 33 34 if ( qty == null ) 35 { 36 cart.put( _itemId, new Integer ( 1 ) ); 37 } 38 else 39 { 40 cart.put( _itemId, new Integer ( 1 + qty.intValue( ) ) ); 41 } 42 43 return SUCCESS; 44 } 45 46 49 public String getItemId( ) 50 { 51 return _itemId; 52 } 53 54 58 public void setItemId( String itemId ) 59 { 60 _itemId = itemId; 61 } 62 } 63 | Popular Tags |