0
먼저 데이터베이스에서 테이블로 값을 전달합니다. 첫 번째 열에서 컨트롤러에서 ID를 삭제하는 함수를 전달하는 폼을 만들고 싶습니다.컨트롤러에 ID 전달
<tr th:each="blg: ${all}" th:object="${blg}" >
<td>
<form th:action="@{/delete}" th:object= "${blg}" method="post">
<input type="text" th:field="${blg.id}"/>
<button type="submit">Delete</button>
</form>
</td>
<td th:text="*{title}"> title </td>
<td th:text="*{content}"> title </td>
<td th:text="*{category}"> title </td>
<td th:text="*{signature}"> title </td>
</tr>
컨트롤러 :
java.lang.IllegalStateException :
@GetMapping("/show")
public String show(Model model){
List<Blog> all = br.findAll();
model.addAttribute("all",all);
return "show";
}
@RequestMapping(value="/delete", method=RequestMethod.POST)
public String deletePost(@RequestParam Long id){
br.delete(id);
return "redirect:/show";
}
가 thymeleaf 엔진은이 오류 occcurs 같은 객체를 매핑하지 않습니다 BindingResult이나 콩 이름에 대한 일반 대상 객체 어느 ' 요청 속성으로 'blg'를 사용할 수 있습니다.
이 경우 올바른 양식을 만드는 방법은 무엇입니까? 아래 그림과 같이