Property or field 'LevelName' cannot be found on null
程序员文章站
2022-04-13 22:45:52
...
Property or field ‘LevelName’ cannot be found on null
1、报错信息:
Springboot+mybatis+thymeleaf多表查询时,thymeleaf页面报错:Property or field ‘LevelName’ cannot be found on null,
图片如下:
2、页面代码:
td th:text="${ulevel.LevelName}">></td>
3、原因
User实体类定义了Ulevel实体的属性,而levelName是Ulevel的属性,usercontroller返回的是user实体,无法获得Ulevel实体的levelName属性。
4、解决方法:
htem页面改为:<td th:text="${user.ulevel.LevelName}"></td>
或者:<td th:text="${user.ulevel.getLevelName()}"></td>
注:这方法不能有空值
上一篇: 使用Dom4j解析XML
下一篇: Go开发环境设置
推荐阅读
-
npm ERR! Cannot read property 'path' of null
-
js报错 Cannot read property 'getAttribute' of null
-
JavaScript Uncaught TypeError: Cannot read property 'value' of null
-
Property or field ‘XXX‘ cannot be found on null
-
el-tooltip组件中content使用Vue-i18n报错TypeError: Cannot read property ‘$t‘ of null
-
Extjs4 tabPanel关闭后打开 cannot read property addcls of null
-
ASP.NET MVC运行出现Uncaught TypeError: Cannot set property __MVC_FormValidation of null的解决方法
-
Vue引入echarts报错Error in mounted hook: “TypeError: Cannot read property ‘getAttribute‘ of null“
-
js或jquery报错Cannot read property 'length' of undefined(Cannot read property 'rows' of null)
-
echarts js报错 Cannot read property 'getAttribute' of null