Page Pagination
I would like your help to guide me to the easiest way to do page pagination in my jsp.
My code is below which is listing the values in a generated table:
<%
while(rs.next()){
%> <a href="cir_view.jsp?cir_id=<%=rs.getString("cir_id")%>" Title="View" onClick="return popup(this, 'Report')">
<%=rs.getString("cir_id")%>
</a>
</span> </td>
<td width="39%" ><span style="font-size: 8pt"><%=rs.getString("institution_name")%></span></td>
<td width="26%" align="left"><span开发者_Python百科 style="font-size: 8pt"><%=rs.getString("requester")%></span></td>
<td width="10%" align="left"><span style="font-size: 8pt">
<%=rs.getString("created_date")%></span></td>
<td width="3%" align="left"><a href="cir_delete.jsp?cir_id=<%=rs.getString("cir_id")%>" class="ask" onclick="target='_blank';">
<IMG SRC="12.png" ALT="Delete" BORDER="0" ></a></td>
<td width="3%" align="left"><a href="cir_update.jsp?cir_id=<%=rs.getString("cir_id")%>" onClick="return popup(this, 'Report')"><IMG SRC="28.png" ALT="Edit" BORDER="0"></a></td>
</div>
</tr>
<%
}
rs.close();
%>
</td>
A good way to start would be:
- move your code to a servlet
- pass page number and page size parameters to a servlet
- make your servlet return up to page_size rows starting from (page_number - 1) * page_size
精彩评论