maria_megha 0 Newbie Poster

can you explain with a simple example what is jsp pagination?
i ve been trying to understand the folowing code in a project..pls help
**********

if(appList!=null){
int pageNoPerPage=0; // Per page only 5 Page Numbers will display

if(numPages%2==0)
pageNoPerPage=numPages/2; // 9/2 => 4 page no per page
else
pageNoPerPage=(numPages/2)+1; // 9/2=>4+1 pages

if(startIndex + numRecordsPerPage < numRows){
%>
<%= "N " + startIndex %> - <%= increment - 1 %>
<%}else{%>
<%= "N " + startIndex %> - <%= numRows %>
<%}%>
<%increment += numRecordsPerPage ;

%>
</td>

<%if(startIndex != 1) {
//startIndex=startIndex-numRecordsPerPage;
%>
<td width="12%" >
<a class="linktxt" href="javascript:ajaxFunction(<%=startIndex-numRecordsPerPage%>,<%=numRows%>,<%=numRecordsPerPage%>,<%=pageNoPerPage%>)">Previous</a>
</td>
<%}
else{%>
<td width="12%" >&nbsp;</td>
<% }
%>
<%
if(startIndex + numRecordsPerPage <= numRows){
%>
<td width="12%" >
<a class="linktxt" href="javascript:ajaxFunction(<%=startIndex+numRecordsPerPage%>,<%=numRows%>,<%=numRecordsPerPage%>, <%=pageNoPerPage%>)">Next</a>
</td></tr>
<%//}
}
}else{
out.println("Matching Record Not Found!!");
}
%>
</table>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.