我想为下面的jsp表实现分页,其中名称,标题和类型将从数据库中检索。我想列出每页的数据1。
在标题中我使用了以下代码
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="/Fileupload/js/jquery.paginate.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$('#paging_container3').pajinate({
num_page_links_to_display : 1,
items_per_page : 1,
}(jQuery));
});
</script>
在jsp文件中,我有以下代码
<div id="paging_container3">
<table border="1" id="myTable">
<tbody>
<tr>
<td><b>Name</b></td>
<td><b>Title</b></td>
<td><b>Genre</b></td>
<%
while(rs.next())
{
String name = rs.getString("Name");
String title = rs.getString("Title");
String genre = rs.getString("Genre");
%>
<tr><td><%=name %></td><td><%=title %></td><td><%=genre %></td></tr>
<%
}
%>
</tbody>
</table>
</div>
任何人都可以建议我必须集中精力解决问题。提前谢谢
答案 0 :(得分:1)
请确保您关注这些内容,并检查pajinate.js
路径。
DEFAULT USAGE
---------------------------------
1) Place pajinate-x.x folder somewhere in your website directory structure.
2) Include script tags for the desired version of the script.
3) Create at least one <div> in your HTML with a CSS class
value of "page_navigation". The navigation links will be
attached to these divs.
4) Ensure that all items you would like to page through are
all the first-children of an HTML element with a CSS
class value of "content". The child-elements can be of any tag type.
5) Call the Pajinate plugin with the function.
有关详情,请浏览此链接。 https://github.com/wesnolte/Pajinate。可能是你的html需要看起来像这样,
<div id="page_container">
<div class="page_navigation"></div>
<ul class="content">
<li> <p>One</p> </li>
<li> <p>Two</p> </li>
<li> <p>Three</p> </li>
<li> <p>Four</p> </li>
<li> <p>Five</p> </li>
<li> <p>Six</p> </li>
<li> <p>Seven</p> </li>
<li> <p>Eight</p> </li>
</ul>
</div>
</div>