@RequestMapping(value = "/edit", method = RequestMethod.GET) public ModelAndView deleteEmployee( @ModelAttribute("command") EmployeeBean employeeBean, BindingResult result) { Map<String, Object> model = new HashMap<String, Object>(); model.put("employee", prepareEmployeeBean(employeeService.getEmployee(employeeBean.getId()))); model.put("employees", prepareListofBean(employeeService.listEmployeess())); return new ModelAndView("addEmployee", model); }
@RequestMapping(value = "/save", method = RequestMethod.POST) public ModelAndView saveEmployee( @ModelAttribute("command") EmployeeBean employeeBean, BindingResult result) { Employee employee = prepareModel(employeeBean); employeeService.addEmployee(employee); return new ModelAndView("redirect:/add.html"); }
@RequestMapping(value = "/employees", method = RequestMethod.GET) public ModelAndView listEmployees() { Map<String, Object> model = new HashMap<String, Object>(); model.put("employees", prepareListofBean(employeeService.listEmployeess())); return new ModelAndView("employeesList", model); }