3 回答

TA贡献1810条经验 获得超5个赞
我认为问题出在这两行上:
<input type="text" th:field:="*{userName}" placeholder="Username (*)" class="form-control" />
<input type="text" th:field:="*{password}" placeholder="First Name (*)" class="form-control" />
:由于您在后面添加了“”列,th:field因此可能会出现错误。所以这两行应该是这样的:
<input type="text" th:field="*{userName}" placeholder="Username (*)" class="form-control" />
<input type="text" th:field="*{password}" placeholder="First Name (*)" class="form-control" />
由于 thymeleaf 没有提供对问题或有问题的行号的良好解释,因此查找问题确实变得很头疼。它只是说“属性名称不能为空”,而您只是搜索空属性。

TA贡献1943条经验 获得超7个赞
我遇到了同样的问题,我只是将错误减少 1 1。所以我对每个输入和每个表单都进行了评论。而问题就在这里
<form action="#" th:action="@{/register/processRegistrationForm}" th:object="${user}" method="POST" class="form-horizontal">
在th:object="${user}"
,也许这个技巧可以帮助你一点,因为这个问题还没有解决。
添加回答
举报