Spring中对象列表的java分页
我的控制器中有一个对象列表
public String postResults(Model model, @RequestParam String shopName) throws IOException {
DataFilter filter = new DataFilter();
List<Row> rows = filter.filterRows(shopName);
model.addAttribute("results", rows);
return "results";
}
以及以下模板的一部分:
<tr th:each="obj : ${results}">
<td><img th:src="${obj.image}" th:class="images"></td>
<td th:utext="${obj.description}"></td>
<td th:utext="${obj.price}"></td>
</tr>
目前,我正试图弄清楚如何在这里实现分页
另外,我已经在同一个基于存储库的项目中进行了分页,现在我需要在没有它的情况下实现同样的分页,只需使用对象列表
# 1 楼答案
谢谢你的评论。这是在DB的帮助下完成的。已将对象列表保存在数据库中,然后通过分页从数据库中重新选择: