@RequestMapping(value = "add", method = RequestMethod.POST) public String add(String title, String startDate, String endDate, String member) throws Exception { Project project = new Project(); project.setTitle(title); project.setStartDate(Date.valueOf(startDate)); project.setEndDate(Date.valueOf(endDate)); project.setMember(member); projectDao.insert(project); return "redirect:list.do"; }
@RequestMapping("update") public String update( int no, String title, String startDate, String endDate, String member, Model model) throws Exception { Project project = new Project(); project.setTitle(title); project.setStartDate(Date.valueOf(startDate)); project.setEndDate(Date.valueOf(endDate)); project.setMember(member); project.setNo(no); if (projectDao.update(project) <= 0) { model.addAttribute("errorCode", "401"); return "project/ProjectAuthError"; } return "redirect:list.do"; }