public String viewUpdateAccount(HttpServletRequest request, Model model, UpdateAccountForm form) { Customer customer = CustomerState.getCustomer(); form.setEmailAddress(customer.getEmailAddress()); form.setFirstName(customer.getFirstName()); form.setLastName(customer.getLastName()); return getUpdateAccountView(); }
public String processUpdateAccount( HttpServletRequest request, Model model, UpdateAccountForm form, BindingResult result, RedirectAttributes redirectAttributes) throws ServiceException { updateAccountValidator.validate(form, result); if (result.hasErrors()) { return getUpdateAccountView(); } Customer customer = CustomerState.getCustomer(); customer.setEmailAddress(form.getEmailAddress()); customer.setFirstName(form.getFirstName()); customer.setLastName(form.getLastName()); customerService.saveCustomer(customer); redirectAttributes.addFlashAttribute("successMessage", getAccountUpdatedMessage()); return getAccountRedirectView(); }