@RequestMapping(value = "/addEmployee", method = RequestMethod.POST)
  public String addEmployee(
      @ModelAttribute("newEmployee") @Valid Employee employee, BindingResult result) {

    if (result.hasErrors()) {
      return "employee";
    }

    if (employee.getId() == 0) {
      employeeDAO.save(employee);
    } else {
      employeeDAO.update(employee);
    }
    return "redirect:/";
  }
  @RequestMapping("/")
  public String home(Model model) {

    model.addAttribute("employee", new Employee());
    List<Employee> empList = employeeDAO.getAll();
    model.addAttribute("employees", empList);
    return "home";
  }
  @RequestMapping("/remove/{id}")
  public String removePerson(@PathVariable("id") int id) {

    employeeDAO.deleteById(id);
    return "redirect:/";
  }
 @RequestMapping("/edit/{id}")
 public String editPerson(@PathVariable("id") int id, Model model) {
   model.addAttribute("newEmployee", employeeDAO.getById(id));
   return "employee";
 }