ZPY博客

thymeleaf判断list或字段非或非空的方法

---
title: thymeleaf判断list或字段非或非空的方法
date: 2018-07-27 08:54:31
categories:
- Java
- Spring
tags:
- thymeleaf
- null
- 空
- list
- "th:if"
---

thymeleaf里判断List为空的写法:

th:if="*{#lists.isEmpty(h_sntkinfHeaderlst)}"

 

判断list非空的写法:

th:if="*{not #lists.isEmpty(h_sntkinfHeaderlst)}"

 

普通字段同样可用上面的#lists.isEmpty来判断