You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
1.0 KiB

java:
//查询sql
String sql = "select * from tab_department_bak where depttypeid=?";
//实例化一个分页查询对象
//方法一传入参数JDBCPageQuery对象和HttpServletRequest对象
PageQuery pageQuery = new PageQuery(new JDBCPageQuery(conn,sql,"10",new HashFmlBufResultSetHandler()),request);
//方法二:
PageQuery pageQuery = new PageQuery(conn,sql,'10',new HashFmlBufResultHandler(),request);
//获得查询结果query方法的传入参数50为每页显示的记录数
HashFmlBuf buf = (HashFmlBuf)pageQuery.query(50);
jsp:
包含auth.jsp页面或者在页面中加入标签引入代码<%@ taglib uri="/WEB-INF/tlds/PageLinkTag.xml" prefix="tag"%>
在查询结果的表格下方加入分页标签代码:<tag:PageLinkTag operate="query" scope="request" width="90%" align="center"/>
其中 operate:查询调用的servlet中的方法名称(optional, default="query");
scope:="request"(required);
width:分页表签的宽度(optional, default="90%");
align:分页标签的对齐方式(optional, default="left");