Пример #1
0
  @RequestMapping(value = "/updateCustomer.htm", method = RequestMethod.POST)
  public ModelAndView updateCustomer(
      @ModelAttribute("customer") @Valid Customer customer,
      BindingResult result,
      SessionStatus status) {

    ModelAndView mav = new ModelAndView();

    if (result.hasErrors()) {
      LOGGER.info("Error occurred in AddCustomer form ");
      mav.setViewName("AddCustomer");
      mav.addObject("customer", customer);
      return mav;
    } else {
      int resultValue = 0;
      resultValue = customerService.updateCustomer(customer);
      LOGGER.info("Customer updated !! ");
      mav.setViewName("AddCustomer");
      mav.addObject("resultValue", resultValue);
      mav.addObject("customer", customer);
      return mav;
    }
  }