1. 程式人生 > >Property or field ‘menuName’ cannot be found on null

Property or field ‘menuName’ cannot be found on null

記錄一下。

寫了一個頁面,新增,編輯,檢視用的都是同一個頁面。 
編輯和檢視沒問題,th:text=${users?.uuserName}是有值的。

<input type="text" name="uuserName" disabled th:text="th:text=${users.uuserName}" class="layui-input">
  • 1

新增就報錯了 Property or field ‘menuName’ cannot be found on null

用下面的方式可以解決:

<!--th:value="${users?.uuserName
}"-->
<input type="text" name="uuserName" disabled th:text="${users?.uuserName}" class="layui-input">