我有一个名为“notifications”的列表,并使用Thymeleaf的“each方法”逐一访问其元素。我可以成功地执行以下操作。
我该如何获得这样的输出?
<li th:each="n : *{notifications}">
<h4 type="text" th:text="*{n.message}"></h4>
</li>
注意:'message'是我需要从列表中检索的属性。
如何以相反的顺序访问元素?例如,如果这是我的当前输出,
Cat
Dog
Rat
我该如何获得这样的输出?
Rat
Dog
Cat