http://www.chinajavaworld.com/non-cgi/usr/48/48_3486.rar

解决方案 »

  1.   


    你说的问题和struts没有关系,和以前使用javabean实现分页的程序是一样的!
      

  2.   

    有没有 sturts+ DAO 分页的程序??
      

  3.   

    大哥,http://www.chinajavaworld.com/non-cgi/usr/48/48_3486.rar下来的文档解压后是pdf的文件,并且被加密了,不能复制 。救我  !!!!!!!
      

  4.   

    还有什么更好的吗?
    都没有描述府小弟我struts菜鸟一个啊 ◎◎ !!
      

  5.   

    分页实现要点:
    1.
    <html:hidden property="currpage"/>
    <html:hidden property="rowsperpage"/>
    <html:hidden property="totalpage"/>
    <html:hidden property="prepage"/>
    <html:hidden property="nextpage"/>
    <html:hidden property="gotopage"/>2.
    <table>
    <tr>
    <td><a href="#" onclick="goto(1);">首页</a></td>
    <td><a href="#" onclick="goto(<bean:write name="statisticsForm" property="prepage"/>);">上页</a></td>
    <td>当前第<bean:write name="statisticsForm" property="currpage"/>页</td>
    <td><a href="#" onclick="goto(<bean:write name="statisticsForm" property="nextpage"/>);">下页</a></td>
    <td><a href="#" onclick="goto(<bean:write name="statisticsForm" property="totalpage"/>);">尾页</a></td>
    </tr>
    </table>
    3.
    <script language="javascript">
    <!--
    function goto(pageno)
    {
    if(pageno > document.statisticsForm.totalpage.value) {
    //alert("");
    pageno = document.statisticsForm.totalpage.value
    }
    if(pageno == 0) {
    pageno = 1;
    }
    document.statisticsForm.gotopage.value=pageno;
    document.statisticsForm.submit();
    }
    -->
    </script>4.Form Bean中:
    import com.ebis.xjyd.util.form.PagingForm; MyForm extends PagingForm 5.Action中:
    import com.ebis.xjyd.util.PagingUtil; // ↓↓↓↓↓↓↓↓↓↓以下分页需要
    int gotoPage = 0;
    if(statisticsForm.getGotopage().equals("")) {
    gotoPage = 1;
    }
    else {
    gotoPage = Integer.parseInt(statisticsForm.getGotopage());
    }

    int rowsPerPage = Integer.parseInt(statisticsForm.getRowsperpage());
    statisticsForm.setNextpage("" + (gotoPage + 1));
    statisticsForm.setCurrpage("" + gotoPage);
    // ↑↑↑↑↑↑↑↑↑↑以上分页需要
    /************
    取得List
     ************/
    // ↓↓↓↓↓↓↓↓↓↓以下分页需要
    if((billfile_statistics_result_list.size() % rowsPerPage) == 0) {
    statisticsForm.setTotalpage("" + 
    (Math.round(billfile_statistics_result_list.size()/rowsPerPage)));
    }
    else {
    statisticsForm.setTotalpage("" + 
    (Math.round(billfile_statistics_result_list.size()/rowsPerPage) + 1));
    }

    statisticsForm.setPrepage("" + (gotoPage - 1));

    Collection collection = PagingUtil.getSubCollection(
    billfile_statistics_result_list, rowsPerPage, gotoPage);
    // ↑↑↑↑↑↑↑↑↑↑以上分页需要