KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > xpetstore > web > struts > action > cart > UpdateCartAction


1 package xpetstore.web.struts.action.cart;
2
3 import javax.servlet.http.HttpServletRequest JavaDoc;
4 import javax.servlet.http.HttpServletResponse JavaDoc;
5
6 import org.apache.struts.action.ActionForm;
7 import org.apache.struts.action.ActionForward;
8 import org.apache.struts.action.ActionMapping;
9
10 import xpetstore.services.cart.ejb.Cart;
11
12 import xpetstore.web.struts.action.BaseAction;
13
14
15 /**
16  * @author <a HREF="mailto:tchbansi@sourceforge.net">Herve Tchepannou</a>
17  *
18  * @struts.action
19  * name="cartForm"
20  * path="/updateCart"
21  * scope="request"
22  * validate="false"
23  *
24  * @struts.action-forward
25  * name="success"
26  * path="/cart.jspa"
27  */

28 public class UpdateCartAction
29     extends BaseAction
30 {
31     //~ Methods ----------------------------------------------------------------
32

33     /**
34      * @see xpetstore.web.struts.action.BaseAction#doExecute(ActionMapping, ActionForm, HttpServletRequest, HttpServletResponse)
35      */

36     protected ActionForward doExecute( ActionMapping mapping,
37                                        ActionForm form,
38                                        HttpServletRequest JavaDoc request,
39                                        HttpServletResponse JavaDoc response )
40         throws Exception JavaDoc
41     {
42         CartForm frm = ( CartForm ) form;
43
44         Cart cart = getCart( request );
45
46         /* Cart items */
47         cart.updateItems( frm.getItemId( ), frm.getQuantity( ) );
48
49         return mapping.findForward( SUCCESS );
50     }
51 }
52
Popular Tags