解决thymeleaf th:value当值为null时报错的问题

方法一:三目运算符 <input type="text" th:value="${userInfo!=null ?userInfo.phone:''}"> 方法二:*{ xx },后台数据要设置为内置对象 <input type="text" class="form-control" th:value="*{qq}"> 建议方法一,简单粗暴
相关文章
相关标签/搜索