当前位置: 移动技术网 > IT编程>开发语言>Java > jsp hibernate的分页代码第1/3页

jsp hibernate的分页代码第1/3页

2017年12月12日  | 移动技术网IT编程  | 我要评论
可见使用hibernate,在进行查询分页的操作上,是具有非常大的灵活性,hibernate会首先尝试用特定数据库的分页sql,如果没用,再尝试scrollable,如果不

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参数
pagemethod=first 是用来在pagehelper类中判断执行哪个操作
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">
<%-- 跳转相应页面,参见下文页面跳转部分 --%>
<html:form action="/viewpage.do">
跳转到
<html:text property="targetpage" size="3" maxlength="3"/>
<html:submit value="go"/>
</html:form>
</td>
<td>
</td>
</tr>
</table>
<%-- 分页导航结束 --%>

  
3

如您对本文有疑问或者有任何想说的,请点击进行留言回复,万千网友为您解惑!

相关文章:

验证码:
移动技术网