zoukankan      html  css  js  c++  java
  • zf-分页后台代码

    java :

    public ResultPage getDeptList(int page, int pageRows) throws Exception {
            String hql="from ZfoaOrgan a where upper(a.isxzfw)='Y' and a.orgFlag=0 and a.orgLayer=1  Order by a.orgId";
            return getResultPage(hql, new Object[]{}, page, pageRows);
        }

    接口必须是ResultPage返回值

    第一种写法:

        ResultPage tmp = consultationService.getDeptList(getPage(),
                    getPageRows());
              setMaxPage(tmp.getMaxPage());  // 必写
              deptList = tmp.getResultList(); // 必写

    第二种常用写法:

     ResultPage tmp;
                tmp = infoTcontentDao.getzcfgPage(getPage(),
                        getPageRows());
                  tcontentList = tmp.getResultList(); // 必写
                  super.setPageParam(tmp);
    /**
    setPageParam();这个方法里面是这样的
        public void setPageParam(ResultPage rp) {
            setMaxPage(rp.getMaxPage());
            setAllRows(rp.getAllRows());
            setThisPageRows(rp.getPageRows());
            setPages();
        }
    
    */

    创建个 ResultPage tmp; 变量 然后调用上面的ResultPage返回值的接口

     setMaxPage(tmp.getMaxPage());  //必写的
       deptList = tmp.getResultList(); // 必写的

    如果分页的20行,但是只显示4行,那么一定是jsp代码的问题,有可能是有2个table.

    jsp
    <div class="quotes">
    <span class="disabled"> < </span>
    <%@include file="../include/pagination.inc" %>
    </div>

    写在跟table一个 div里 但是要写在table外面。

     
     
  • 相关阅读:
    3、linux网络编程--网络字节序
    1、linux网络编程--网络协议
    第四篇:进程
    第五篇:进程通信
    第六篇:线程原理
    操作系统基本概念
    第一篇:基础原理篇
    第二篇:操作系统历史
    (2)linux下的简单的socket通信实例
    (3)基于linux的socket编程TCP半双工client-server聊天程序
  • 原文地址:https://www.cnblogs.com/YangK-java/p/4849840.html
Copyright © 2011-2022 走看看