I compiled and added the paginate-head.jar to my build-path. In my Controller, I get the paginator, and pass it to render.
public static void newjoinee() {
ValuePaginator vp = help.showNewJoineesList();
render(vp);
}
I also added dummy values to the List, and instantiated the Paginator using this list in addition to the List being created as a result of the query.
public ValuePaginator showNewJoineesList() {
List<String> foo = new ArrayList<String>();
ArrayList<String> bar = new ArrayList<String>();
bar.add("Ek");
bar.add("Don");
bar.add("Teen");
ValuePaginator vpaginator = new ValuePaginator(bar);
//Also tried to pass a list obtained as a result of a query.
//foo = databaseAgent.getloginuserdata();
//ValuePaginator vpaginator = new ValuePaginator(foo);
return vpaginator;
}
In my view, I try to display the list as below, taken from another SO question.
#{paginate.list items:paginator, as:'r'}
<table>
<tr>
<td>${r[0]}</td>
<td>${r[1]}</td>
<td>${r[2]}</td>
</tr>
</table>
#{/paginate.list}
I cannot see the list in the view. Any solutions?
The first weird thing in your example is that you render a ‘vp’ variable and use a ‘paginator’ variable in your view, try to rename your variable to ‘paginator’ in your controller