@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 EmployeeBean prepareEmployeeBean(Employee employee) {
   EmployeeBean bean = new EmployeeBean();
   bean.setAddress(employee.getEmpAddress());
   bean.setAge(employee.getEmpAge());
   bean.setName(employee.getEmpName());
   bean.setSalary(employee.getSalary());
   bean.setId(employee.getEmpId());
   return bean;
 }
 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;
 }
 private List<EmployeeBean> prepareListofBean(List<Employee> employees) {
   List<EmployeeBean> beans = null;
   if (employees != null && !employees.isEmpty()) {
     beans = new ArrayList<EmployeeBean>();
     EmployeeBean bean = null;
     for (Employee employee : employees) {
       bean = new EmployeeBean();
       bean.setName(employee.getEmpName());
       bean.setId(employee.getEmpId());
       bean.setAddress(employee.getEmpAddress());
       bean.setSalary(employee.getSalary());
       bean.setAge(employee.getEmpAge());
       beans.add(bean);
     }
   }
   return beans;
 }