1 package xpetstore.web.struts.action.customer; 2 3 import javax.servlet.http.HttpServletRequest ; 4 import javax.servlet.http.HttpServletResponse ; 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.domain.customer.ejb.Customer; 11 12 import xpetstore.services.petstore.exceptions.DuplicateEmailException; 13 14 import xpetstore.web.struts.action.BaseAction; 15 16 17 35 public class UpdateCustomerAction 36 extends BaseAction 37 { 38 40 43 protected ActionForward doExecute( ActionMapping mapping, 44 ActionForm form, 45 HttpServletRequest request, 46 HttpServletResponse response ) 47 throws Exception 48 { 49 CustomerForm frm = ( CustomerForm ) form; 50 Customer cust = frm.getCustomer( ); 51 52 try 53 { 54 getPetstore( ).updateCustomer( cust ); 55 56 initSession( cust, request ); 57 58 return mapping.findForward( SUCCESS ); 59 } 60 catch ( DuplicateEmailException de ) 61 { 62 request.setAttribute( MESSAGE_KEY, "duplicate_email" ); 63 64 return mapping.findForward( ERROR ); 65 } 66 } 67 } 68 | Popular Tags |