Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to check if list is empty using thymeleaf?

Tags:

html

thymeleaf

<div th:if="${tblUserList != null}">  --content-- </div> 

The above thymeleaf code is not working, where tblUserList is a list. So I want to check whether the list is empty instead of checking its null. How to do that?

like image 853
Rahul Raj Avatar asked Oct 13 '15 15:10

Rahul Raj


1 Answers

You can do as follows:

<div th:if="${not #lists.isEmpty(tblUserList)}">  --content-- </div> 
like image 108
taxicala Avatar answered Sep 19 '22 02:09

taxicala