jsp hibernate的分頁代碼
更新時間:2008年09月27日 15:17:40 作者:
在查詢分頁代碼中使用Hibernate的一大好處是,既兼顧了查詢分頁的性能,同時又保證了代碼在不同的數(shù)據(jù)庫之間的可移植性。
jsp頁面一:
第頁
共頁
="/bussiness/clInfo/queryWithPage.do?method=queryWithPage&pageMethod=
first
上一頁
下一頁
尾頁
" paramName="PAGER" paramProperty="currentPage" paramId="currentPage">
首頁
解釋一下這一行:"/bussiness/clInfo/queryWithPage.do?method=queryWithPage&pageMethod=first
method=queryWithPage 是由于我的Action繼承的是DispatchAction,需要一個method參數(shù)
pageMethod=first 是用來在PageHelper類中判斷執(zhí)行哪個操作
jsp頁面二:
<%-- 分頁導航 --%>
<table border="0" width="780" class="pageInfo">
<tr>
<td width="250">
共 <bean:write name="pager" property="totalRows"/><span class="pageInfo">條記錄 </span>
第 <bean:write name="pager" property="currentPage"/>/<bean:write name="pager" property="totalPages"/>頁
</td>
<td align="right" width="60">
<html:link page="/Displayall.do?viewPage=&action=first">首頁</html:link>
</td>
<td align="right" width="60">
<logic:equal name="pager" property="hasPrevious" value="true">
<html:link page="/Displayall.do?viewPage=&action=previous">上一頁</html:link>
</logic:equal>
<logic:equal name="pager" property="hasPrevious" value="false">
<span class="invalidLink">上一頁</span>
</logic:equal>
</td>
<td align="center" width="4">
</td>
<td align="left" width="60">
<logic:equal name="pager" property="hasNext" value="true" >
<html:link page="/Displayall.do?viewPage=&action=next">下一頁</html:link>
</logic:equal>
<logic:equal name="pager" property="hasNext" value="false">
<span class="invalidLink">下一頁</span>
</logic:equal>
</td>
<td width="60">
<html:link page="/Displayall.do?viewPage=&action=last">末頁</html:link>
</td>
<td width="160" align="rigth">
<%-- 跳轉(zhuǎn)相應頁面,參見下文頁面跳轉(zhuǎn)部分 --%>
<html:form action="/ViewPage.do">
跳轉(zhuǎn)到
<html:text property="targetPage" size="3" maxlength="3"/>
<html:submit value="GO"/>
</html:form>
</td>
<td>
</td>
</tr>
</table>
<%-- 分頁導航結(jié)束 --%>
相關(guān)文章
Tomcat5+Mssql server 2000數(shù)據(jù)庫連接池配置之旅
Tomcat5+Mssql server 2000數(shù)據(jù)庫連接池配置之旅...2006-10-10純jsp實現(xiàn)的倒計時動態(tài)顯示效果完整代碼
這篇文章主要介紹了純jsp實現(xiàn)的倒計時動態(tài)顯示效果代碼,涉及JSP時間操作的相關(guān)技巧,具有一定參考借鑒價值,需要的朋友可以參考下2015-10-10