本文介绍了如何限制每个页面中的HTML表记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在我的jsp中填充一个表,该表有20多个记录.现在,如果我想在页面中显示每10条记录,然后用户单击下一个链接转到其他20条记录.

I am populating a table in my jsp which has more than 20 records. Now, If I want to display each 10 records in a page and then the user clicks on next link to go to the other 20 records.

如何在我的jsp中执行此操作?

How can I do that in my jsp?

这是我当前的代码

<table>
    <tr>
        <td>id</td>
        <td>name</td>
        <td>type</td>
    </tr>
<%
    while(resultSet.next())
    {
        %>
        <tr>
        <td><%=resultSet.getString(1)%></td>
        <td><%=resultSet.getString(2)%></td>
        <td><%=resultSet.getString(3)%></td>
    </tr>
<%
    }
%>
</table>

推荐答案

您想要的是分页代码示例.这是我在网上找到的: http://www.easywayserver.com/blog/jsp-pagination /有很多这样的例子,您将必须找到导航链接所喜欢的一种格式

What you want is a pagination code example. Here's one I found online: http://www.easywayserver.com/blog/jsp-pagination/ There are lots of examples of this and you'll have to find which one formats your nav links the way you like them

这篇关于如何限制每个页面中的HTML表记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 03:00