How to print Array size in thymeleaf?

后端 未结 2 570
感动是毒
感动是毒 2021-02-02 11:17

I\'m using Thymeleaf with spring mvc 4 but I have a problem when I want to print a list size

         


        
相关标签:
2条回答
  • 2021-02-02 11:56

    Try using the utility method for org.thymeleaf.expression.Lists:

    <td th:text="${#lists.size(u.engines)}">[Engine Size]</td>
    
    0 讨论(0)
  • 2021-02-02 12:13

    Besides the util method vphilipnyc described, instead of list.size, use list.size().

    When writing list.size, it's trying to call list.getSize() and an List (or a collection) doesn't have a getter named like this.

    0 讨论(0)
提交回复
热议问题