FileDocCategorySizeDatePackage
CreateCustomerAction.javaAPI DocJBoss 4.2.12119Fri Jul 13 20:56:04 BST 2007xpetstore.web.struts.action.customer

CreateCustomerAction

public class CreateCustomerAction extends xpetstore.web.struts.action.BaseAction
author
Herve Tchepannou
struts.action
name="customerForm" path="/createCustomer" scope="request" validate="true" input="/register.jsp"
struts.action-forward
name="success" path="/signon.jspa"
struts.action-forward
name="error" path="/register.jsp"

Fields Summary
Constructors Summary
Methods Summary
protected org.apache.struts.action.ActionForwarddoExecute(org.apache.struts.action.ActionMapping mapping, org.apache.struts.action.ActionForm form, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)

see
xpetstore.web.struts.action.BaseAction#doExecute(ActionMapping, ActionForm, HttpServletRequest, HttpServletResponse)

        CustomerForm  frm = ( CustomerForm ) form;
        Customer cust = frm.getCustomer(  );

        try
        {
            getPetstore(  ).createCustomer( cust );
            return mapping.findForward( SUCCESS );
        }
        catch ( DuplicateAccountException da )
        {
            request.setAttribute( MESSAGE_KEY, "duplicate_account" );

            return mapping.findForward( ERROR );
        }
        catch ( DuplicateEmailException de )
        {
            request.setAttribute( MESSAGE_KEY, "duplicate_email" );

            return mapping.findForward( ERROR );
        }