Thymeleaf之SpelEvaluationException: EL1007E: Property or field '***' canno be found on null
时间:2020-06-19 20:09:39
收藏:0
阅读:314
modelAndView.addObject("loginUser", user);
loginUser里面有username属性
当我们想获取username时,需要加上if判断,即判断loginUser不为null
<th:block th:if="${loginUser!= null}">
<p th:text="${loginUser.username}"></p>
</th:block>
原文:https://www.cnblogs.com/da-hao/p/13164596.html
评论(0)