Counters in Loops in Thymeleaf

前端 未结 2 1249
再見小時候
再見小時候 2021-02-12 20:49

Is there a way to do a loop in Thymeleaf without a list?

I\'d like to essentially convert this snippet to Thymeleaf:



        
2条回答
  •  离开以前
    2021-02-12 21:04

    In case you are still looking for the correct SpEL syntax, here's what worked for me:

    
    

    Notice:

    • added th:text to set the option text.
    • used Joda-Time instead as java.util.Date wouldn't give me the desired outcome

    Read this discussion on java.util.Date and getYear()

提交回复
热议问题