Java中有没有很好的分页控件呢
解决方案 »
- SSH2 web 项目参数 如何初始化
- tomcat中工程部署不成功
- Error while removing context
- 怎样做出像51job那样的弹出可拖动层?
- 编码问题一直搞的不是很清楚
- 大家帮帮忙 分析一下 我错在哪里 用JSP连接SQLSERVER出错
- tomcat的 BufferOverflowException 如何解决
- 一個OA類系統,servlet實現的,需要Applet支持,踢踢意見。
- jsp如何制作动态的家族谱
- request.getParameter获取不了值怎么回事?
- 大侠来解决一下这个特殊的servlet 404错误?
- 新手ssh2 hibernate的session从何处获取?
List countries = new ArrayList();
for (int i = 1; i <= 10; i++)
{
Map cinfo = new java.util.HashMap();
cinfo.put("cno", "coutry"+i);
cinfo.put("cname", "国家"+i);
cinfo.put("area", "所在州"+i);
cinfo.put("born",new Date());
countries.add(cinfo);
}
request.setAttribute("cinfos", countries);
%> <ec:table
items="cinfos"
action="${pageContext.request.contextPath}/index.jsp"
imagePath="${pageContext.request.contextPath}/images/table/*.gif"
cellpadding="1"
title="您好!这是eXtremeTable的一个测试例子">
<ec:row highlightRow="true">
<ec:column property="cno"/>
<ec:column property="cname"/>
<ec:column property="area"/>
<ec:column property="born" cell="date" format="yyyy-MM-dd"/>
</ec:row>
</ec:table>
var g = new dojox.grid.EnhancedGrid({
//……其他配置省略
plugins: {
pagination: {
pageSizes: ['5', '10', '20', 'All'], //注意必须是字符串,至于理由,不要问我…
maxPageStep: 5, //在右边最多显示几页
itemTitle: 'items', //默认把每一行称作一个item,当然可以改成别的
descTemplate: '${2} - ${3} of ${1} ${0}'
//这个比较复杂,${0}就是刚才的itemTitle,${1}是总行数,${2}和${3}分别是起止行。
description: true, //如果设置成False,就没有最左边的描述信息了
sizeSwitch: true, //如果设置成False,中间的行数切换就没了
pageStepper: true //如果设置成False,右边的页面切换也省了
}
}
});
//……其他配置省略
plugins: { pagination: true //当然,也可以是空对象{}
}
});<script type="text/javascript" src="./dojo/dojo.js" djConfig="isDebug:false, parseOnLoad: true, locale: 'zh'"></script>DOJO中文博客,CSDN
http://blog.csdn.net/dojotoolkit/
curpage-当前页
maxcount-你要去几条数据
@SuppressWarnings("unchecked")
public List<TblSr> list(int id, final int curpage,final int maxcount) {
final String hql=" from TblSr sr where sr.tblUser.id ="+id;
return (List<TblSr>)getHibernateTemplate().execute(new HibernateCallback() {
public Object doInHibernate(Session session) throws HibernateException,
SQLException {
Query query=session.createQuery(hql);
query.setFirstResult((maxpage-1)*curpage);
query.setMaxResults(maxpage);
return query.list();
}
});
}