package com.lhkj.util.beans;public class Page {
private int pagesize;
private int startnum;
public Page(int startnum,int size){
this.startnum=startnum;
this.pagesize=size;
}
public int getPagesize() {
return pagesize;
}
public void setPagesize(int pagesize) {
this.pagesize = pagesize;
}
public int getStartnum() {
return startnum;
}
public void setStartnum(int startnum) {
this.startnum = startnum;
}
}
action里面 // 从页面获得偏移量
Integer pagesize=30;
session.setAttribute("pagesize", pagesize);
// 从页面获得偏移量
String offset = request.getParameter("pager.offset"); if (offset == null) {
// 第一次查询,需要查出记录总数
String count = "";
count = this.technologyStoreService
.findTechByisAuditSharePageNum(2).toString();
// 只需要下传页面总记录数,每页记录数即可。
session.setAttribute("resultSize", count);
} if (offset == null || offset.equals("")) {
offset = "0";
}
int intoffset = 0;
if (offset != null && !offset.equals("")) {
intoffset = Integer.parseInt(offset);
} final Page page = new Page(intoffset, pagesize);
session.setAttribute("pagesize", pagesize);
// 查询处索要的list
List tmp = this.technologyStoreService
.findTechByisAuditSharePage(2, page);
session.setAttribute("slist", tmp);
jsp里面 <pg:pager items="${sessionScope.resultSizeDetail }"
maxPageItems="${requestScope.pagesizeDetail}"
maxIndexPages="<%=10%>" isOffset="<%=true%>"
url="/lhkjywgl/technologyStore/addTechnologyStore.do"
export="offset,currentPageNumber=pageNumber"
scope="request">
<pg:param name="operate" value="detail"></pg:param>
<pg:param name="technologyStore1"
value="${technologyStore1}"></pg:param>
<pg:param name="recopyId" value="${recopyId}"></pg:param>
<pg:param name="recopyIdd" value="${recopyIdd}"></pg:param>
<pg:param name="id" value="${id}"></pg:param>
<pg:param name="op" value="op"></pg:param>
<pg:param name="niming" value="0"></pg:param>
<jsp:include page="/plugins/paging/jsp/altavista.jsp"
flush="true" />
<!-- 从page对象中取得属性值firstItem , lastIterm -->
<pg:page export="firstItem, lastItem">
<font color="red">本页 <strong><%=firstItem%>
</strong> -- <strong> <%=lastItem%> </strong>条 <strong>/</strong>
总记录数 <strong><bean:write name="resultSizeDetail" />
</strong>条 </font>
</pg:page>
</pg:pager>楼主参考!
private int pagesize;
private int startnum;
public Page(int startnum,int size){
this.startnum=startnum;
this.pagesize=size;
}
public int getPagesize() {
return pagesize;
}
public void setPagesize(int pagesize) {
this.pagesize = pagesize;
}
public int getStartnum() {
return startnum;
}
public void setStartnum(int startnum) {
this.startnum = startnum;
}
}
action里面 // 从页面获得偏移量
Integer pagesize=30;
session.setAttribute("pagesize", pagesize);
// 从页面获得偏移量
String offset = request.getParameter("pager.offset"); if (offset == null) {
// 第一次查询,需要查出记录总数
String count = "";
count = this.technologyStoreService
.findTechByisAuditSharePageNum(2).toString();
// 只需要下传页面总记录数,每页记录数即可。
session.setAttribute("resultSize", count);
} if (offset == null || offset.equals("")) {
offset = "0";
}
int intoffset = 0;
if (offset != null && !offset.equals("")) {
intoffset = Integer.parseInt(offset);
} final Page page = new Page(intoffset, pagesize);
session.setAttribute("pagesize", pagesize);
// 查询处索要的list
List tmp = this.technologyStoreService
.findTechByisAuditSharePage(2, page);
session.setAttribute("slist", tmp);
jsp里面 <pg:pager items="${sessionScope.resultSizeDetail }"
maxPageItems="${requestScope.pagesizeDetail}"
maxIndexPages="<%=10%>" isOffset="<%=true%>"
url="/lhkjywgl/technologyStore/addTechnologyStore.do"
export="offset,currentPageNumber=pageNumber"
scope="request">
<pg:param name="operate" value="detail"></pg:param>
<pg:param name="technologyStore1"
value="${technologyStore1}"></pg:param>
<pg:param name="recopyId" value="${recopyId}"></pg:param>
<pg:param name="recopyIdd" value="${recopyIdd}"></pg:param>
<pg:param name="id" value="${id}"></pg:param>
<pg:param name="op" value="op"></pg:param>
<pg:param name="niming" value="0"></pg:param>
<jsp:include page="/plugins/paging/jsp/altavista.jsp"
flush="true" />
<!-- 从page对象中取得属性值firstItem , lastIterm -->
<pg:page export="firstItem, lastItem">
<font color="red">本页 <strong><%=firstItem%>
</strong> -- <strong> <%=lastItem%> </strong>条 <strong>/</strong>
总记录数 <strong><bean:write name="resultSizeDetail" />
</strong>条 </font>
</pg:page>
</pg:pager>楼主参考!
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货