2
私はSpring Bootで新しく、Thymeleafに問題があります。 For Eachサイクルの下でHTMLフォームを使用したいが、例外を受け取る。ThymeleafのFor-Eachサイクルの下にフォームがある場合
これは私のコードです:
<tr th:each="item : ${users}">
<td th:text="${item.getFirstName()}">First Name</td>
<td th:text="${item.getLastName()}">Last Name</td>
<td th:text="${item.getEmailAddress()}">Email Address</td>
<td th:text="${item.getDateOfBirth()}">Date of Birth</td>
<!--<td><a th:href="${'/user/edit/' + user.id}">Edit</a></td> -->
<td>Edit</td>
<td>
<form th:object="${item}" th:action="@{/delete}" method="post">
<input type="hidden" th:field="*{firstName}"/>
<input type="hidden" th:field="*{lastName}"/>
<input type="hidden" th:field="*{emailAddress}"/>
<input type="hidden" th:field="*{dateOfBirth}"/>
<input type="submit" value="Delete"/>
</form>
</td>
</tr>
そして、これは私が受け取る例外です:
[THYMELEAF][http-nio-8080-exec-1] Exception processing template "users": Error during execution of processor 'org.thymeleaf.spring4.processor.attr.SpringInputGeneralFieldAttrProcessor' (users:31)
あなたは私が間違って何をやっている私に言うことはできますか?
ありがとうございます!
[OK]を、ありがとうございました。私は自分の問題を各ユーザアカウントにidを追加して解決し、POSTクエリで完全なオブジェクトを渡す必要はありませんでした。 –