Message Boards

pagination in liferay

thumbnail
mukesh kumar, modified 11 Years ago.

pagination in liferay

Junior Member Posts: 57 Join Date: 3/13/12 Recent Posts
Hi All

When i am clicking on next button in pagination it is going not displaying next five records . it is again going to the same page.
i have requirement of displaying next five records from the db .if i click on next button again it will display the next five records .
how to achieve this task. i am using the below code .

<%@page import="com.liferay.portal.kernel.util.ListUtil"%>
<%@ include file="init.jsp" %>

<%@page import="com.liferay.portal.kernel.util.Validator"%>
<portlet:actionURL var="findURL" name="findBooks" />
<% List books = (List) request.getAttribute("result");
if(Validator.isNull(books))books = new ArrayList();
%>
<form action="<%=findURL.toString()%>" name="fm" method="post">


<label>Book Title </label>
<input name="title" value=""/>
<input type="submit" value="Search"/>
</form>
<liferay-ui:search-container delta="5" emptyResultsMessage="no-books-were-found">
<liferay-ui:search-container-results>

<%
results=ListUtil.subList(books,searchContainer.getStart(), searchContainer.getEnd());
total=books.size();
pageContext.setAttribute("results", results);
pageContext.setAttribute("total", total); %>
</liferay-ui:search-container-results>



<liferay-ui:search-container-row className="com.test.model.Book" modelVar="book" >
<liferay-ui:search-container-column-text
name="Book Title"
property="name"/>
<liferay-ui:search-container-column-text
name="Author"
property="author"/>
</liferay-ui:search-container-row>
<liferay-ui:search-iterator/>
</liferay-ui:search-container>

Can anybody help me plase .
Regards,
Mukesh kumar