modelAndView.addObject("loginUser", user);
loginUser里面有username属性
当我们想获取username时,需要加上if判断,即判断loginUser不为null
<th:block th:if="${loginUser!= null}">
<p th:text="${loginUser.username}"></p>
</th:block>
2023-11-21 21:29:34
modelAndView.addObject("loginUser", user);
loginUser里面有username属性
当我们想获取username时,需要加上if判断,即判断loginUser不为null
<th:block th:if="${loginUser!= null}">
<p th:text="${loginUser.username}"></p>
</th:block>