赵永恩
1、首先是在后台查询出每页的条数,然后封装,在页面显示。
2、相应代码
<%@ page contentType="text/html; charset=utf-8" language="java" import="com.cpt.ygc.entity.*"%>
<%@ page import = "com.cpt.ygc.db.*,com.cpt.ygc.service.*,javax.sql.*,java.util.*"%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@page isELIgnored="false"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
分页
<%
request.setCharacterEncoding("UTF-8");
String zykclassid_id=(String)session.getAttribute("zykclassid_id");
int zykclassid=Integer.parseInt(zykclassid_id);//类型id
int zyktype=0;//状态
int pageNo=0;
int pageper=10;
String zykqikansearchword=(String)session.getAttribute("zykqikansearchword");
int i=0;
try{
//可以通过参数pageno获得用户选择的页码
pageNo = Integer.parseInt(request.getParameter("pageno") );
}catch(Exception ex){
//默认为第一页
pageNo=1;
}
ZykQikanService columns=new ZykQikanService();
RowSetPage myBean=columns.getAllQikan(zykqikansearchword,zykclassid,zyktype,pageNo,pageper);
request.setAttribute("empPage", myBean);
%>
<%
RowSetPage empPage = (RowSetPage)request.getAttribute("empPage");
if (empPage == null ) empPage = RowSetPage.EMPTY_PAGE;
%>