Thymeleaf: create a list of elements statically
The following code can be used to statically create a list of elements (numbers, strings, etc) inside a Thymeleaf view.
A list of integers:
intList = ${ {1, 2, 3, 4} }
A list of strings:
strList = ${ {'netgloo', 'web', 'design'} }
Usage example
<div th:with="strList = ${ {'netgloo', 'web', 'design'} }">
<!-- Some code using ${strList} -->
<ul>
<li th:each="s : ${strList}" th:text="|${s}|"></li>
</ul>
</div>
References
-
Kumar
-
Andrea
-
-
jebin
-
Andrei
Thymeleaf 












