由于您正在使用用户,因此应将您添加到所有属性用户。
在这里您会找到工作代码`
<!DOCTYPE html><html lang="en" xmlns:th="http://www.thymeleaf.org"><head> <meta charset="UTF-8"/> <title>Registration page</title></head><body><form name='regForm' th:userDto="${user}" th:action="@{/registration}" enctype="utf8" method="post"> <table> <tr> <td>User:</td> <td><input type="text" th:field="*{user.username}"/></td> </tr> <tr> <td>Email:</td> <td><input type='email' th:field="*{user.email}"/></td> </tr> <tr> <td>Password:</td> <td><input type='password' th:field="*{user.password}"/></td> </tr> <tr> <td>Matching password:</td> <td><input type='password' th:field="*{user.matchingPassword}"/></td> </tr> <tr> <td><input name="submit" type="submit" value="submit" /></td> </tr> </table></form></body></html>`



