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}"
,也許這個技巧可以幫助你一點,因為這個問題還沒有解決。
添加回答
舉報