Property or field ‘menuName’ cannot be found on null

记录一下。

写了一个页面,新增,编辑,查看用的都是同一个页面。 
编辑和查看没问题,th:text=${users?.uuserName}是有值的。

<input <span class="hljs-class"><span class="hljs-keyword">type</span>=</span><span class="hljs-string">"text"</span> name=<span class="hljs-string">"<span style="color:rgb(0,153,0);font-family:Consolas, Inconsolata, Courier, monospace;font-size:14px;white-space:pre;background-color:rgb(246,248,250);">uuserName</span>"</span> disabled th:<span style="color:#000088;">text</span>=<span class="hljs-string">"th:text=${users.uuserName}"</span> <span class="hljs-keyword">class</span>=<span class="hljs-string">"layui-input"</span>>
  • 1

新增就报错了 Property or field ‘menuName’ cannot be found on null

用下面的方式可以解决:

<span class="hljs-comment"><!--th:value="${<span style="color:rgb(0,153,0);font-family:Consolas, Inconsolata, Courier, monospace;font-size:14px;white-space:pre;background-color:rgb(246,248,250);">users?.uuserName</span>}"--></span>
<span class="hljs-tag"><<span class="hljs-title">input</span> <span class="hljs-attribute">type</span>=<span class="hljs-value">"text"</span> <span class="hljs-attribute">name</span>=<span class="hljs-value">"<span style="color:rgb(0,153,0);font-family:Consolas, Inconsolata, Courier, monospace;font-size:14px;white-space:pre;background-color:rgb(246,248,250);">uuserName</span>"</span> <span class="hljs-attribute">disabled</span> <span class="hljs-attribute">th:text</span>=<span class="hljs-value">"${<span style="color:rgb(0,153,0);font-family:Consolas, Inconsolata, Courier, monospace;font-size:14px;white-space:pre;background-color:rgb(246,248,250);">users?.uuserName}</span>"</span> <span class="hljs-attribute">class</span>=<span class="hljs-value">"layui-input"</span>></span>

发表回复

您的电子邮箱地址不会被公开。

昵称 *