Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iterating over PagedListHolder in jsp

How can I process PagedListHolder in JSP?

In my controller I have this:

PagedListHolder<Logo> pagedListHolder = new PagedListHolder<Logo>(listLogo);
pagedListHolder.setPageSize(2);

and in my jsp:

<c:forEach items="${pagedListHolder}" var="listHolderItem">

But it does not work. JSTL can not iterate over pagedListHolder;

#

newer mind, I got it:

in order to process PagedListHolder list you need to get de list back from the PagedListHolder. This is how you do it:

PagedListHolder<Logo> pagedListHolder = new PagedListHolder<Logo>(listLogo);
pagedListHolder.setPageSize(2);

List<Logo> pagedListLogo = pagedListHolder.getPageList();

model.addAttribute("pagedListLogo", pagedListLogo);

in your jsp:

<c:forEach items="${pagedListLogo}" var="logo">
...

voila, it works. :)

like image 812
aki Avatar asked Apr 14 '12 13:04

aki


1 Answers

As you noted, you should get the list. Two ways to do that:

  • in the controller, with model.addAttribute("list", pagedList.getPageList())
  • in the JSP, with <c:forEach items="${list.pageList}">
like image 141
Bozho Avatar answered Sep 21 '22 15:09

Bozho