FileDocCategorySizeDatePackage
RemoveItemAction.javaAPI DocJBoss 4.2.11433Fri Jul 13 20:56:04 BST 2007xpetstore.web.struts.action.cart

RemoveItemAction.java

package xpetstore.web.struts.action.cart;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import xpetstore.web.struts.action.BaseAction;
import xpetstore.web.struts.action.item.ItemForm;


/**
 * @author <a href="mailto:tchbansi@sourceforge.net">Herve Tchepannou</a>
 *
 * @struts.action
 *      name="itemForm"
 *      path="/removeItem"
 *      scope="request"
 *      validate="false"
 *
 * @struts.action-forward
 *      name="success"
 *      path="/cart.jspa"
 */
public class RemoveItemAction
    extends BaseAction
{
    //~ Methods ----------------------------------------------------------------

    /**
     * @see xpetstore.web.struts.action.BaseAction#doExecute(ActionMapping, ActionForm, HttpServletRequest, HttpServletResponse)
     */
    protected ActionForward doExecute( ActionMapping       mapping,
                                       ActionForm          form,
                                       HttpServletRequest  request,
                                       HttpServletResponse response )
        throws Exception
    {
        ItemForm frm = ( ItemForm ) form;
        String   itemId = frm.getItemId(  );

        getCart( request ).removeItem( itemId );

        return mapping.findForward( SUCCESS );
    }
}