@RequestMapping(value = "/addTodo", method = RequestMethod.POST) public String addContact(@ModelAttribute("todoList") TodoList todoList, BindingResult result) { // todoList.setContents(Contents); // System.out.println("Contents:" + todoList.getContents() + "Emergency:" + // todoList.getEmergency()); LocalTransaction tx = AppConfig.getLocalTransaction(); tx.begin(); Todo todoii = new Todo(); TodoDao dao; dao = new TodoDaoImpl(); System.out.println("result = " + todoList.getId()); todoii.Id = dao.selectAll().size() + 1; todoii.Contents = todoList.getContents(); System.out.println("result1 = " + todoList.getContents()); todoii.Emergency = Integer.parseInt(todoList.getEmergency()); todoii.Date = java.sql.Date.valueOf(todoList.getDate()); dao.insert(todoii); tx.commit(); return "redirect:todoList.html"; }