@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); }
private Employee prepareModel(EmployeeBean employeeBean) { Employee employee = new Employee(); employee.setEmpAddress(employeeBean.getAddress()); employee.setEmpAge(employeeBean.getAge()); employee.setEmpName(employeeBean.getName()); employee.setSalary(employeeBean.getSalary()); employee.setEmpId(employeeBean.getId()); employeeBean.setId(null); return employee; }