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

CustomerForm

public class CustomerForm extends BaseForm
author
Herve Tchepannou
struts.form
name="customerForm"

Fields Summary
private xpetstore.domain.customer.ejb.Customer
_customer
Constructors Summary
public CustomerForm()


    //~ Constructors -----------------------------------------------------------

       
    
        _customer.setAccount( new Account(  ) );
    
Methods Summary
public xpetstore.domain.customer.ejb.CustomergetCustomer()

        return _customer;
    
public voidsetCustomer(xpetstore.domain.customer.ejb.Customer customer)

        _customer = customer;
    
public org.apache.struts.action.ActionErrorsvalidate(org.apache.struts.action.ActionMapping mapping, javax.servlet.http.HttpServletRequest request)

        ActionErrors errors = new ActionErrors(  );

        Account account = getCustomer(  ).getAccount(  );
        String       userId = account.getUserId(  );
        String       passwd = account.getPassword(  );
        checkNotEmpty( userId, "userId_required", errors );
        checkLength( userId, 4, "userId_length", errors );
        checkNotEmpty( passwd, "password_required", errors );
        checkLength( passwd, 4, "password_length", errors );

        checkNotEmpty( _customer.getEmail(  ), "email_required", errors );
        checkNotEmpty( _customer.getCreditCardType(  ), "ccType_required", errors );
        checkNotEmpty( _customer.getCreditCardNumber(  ), "ccNumber_required", errors );
        checkNotEmpty( _customer.getCreditCardExpiryDate(  ), "ccExpiryDate_required", errors );
        checkCreditCardDateFormat( _customer.getCreditCardExpiryDate(  ), "ccExpiryDate_bad_format", errors );

        return errors;