1 package xpetstore.web.struts.action.cart; 2 3 import java.util.Collection ; 4 5 import javax.servlet.http.HttpServletRequest ; 6 import javax.servlet.http.HttpServletResponse ; 7 8 import org.apache.struts.action.ActionForm; 9 import org.apache.struts.action.ActionForward; 10 import org.apache.struts.action.ActionMapping; 11 12 import xpetstore.services.cart.ejb.Cart; 13 14 import xpetstore.web.struts.action.BaseAction; 15 16 17 30 public class CartAction 31 extends BaseAction 32 { 33 35 38 protected ActionForward doExecute( ActionMapping mapping, 39 ActionForm form, 40 HttpServletRequest request, 41 HttpServletResponse response ) 42 throws Exception 43 { 44 CartForm frm = ( CartForm ) form; 45 46 Cart cart = getCart( request ); 47 48 49 Collection items = cart.getCartItems( ); 50 frm.setCartItems( items ); 51 52 53 double total = cart.getTotal( ); 54 frm.setTotal( total ); 55 56 return mapping.findForward( SUCCESS ); 57 } 58 } 59 | Popular Tags |