zoukankan      html  css  js  c++  java
  • 分页中的难点

    1, 分页的数据:6个要素,

    l 当前面:pageCodepc

    l 总页数:totalPagestp

    l 总记录数:totalRecoredtr

    l 每页记录数:业务数据或叫系统数据!10行!

    l 当前页数据:beanList

    l url

    2,分页在各层之间的处理:

    l 页面:给出分页相关的链接们!

    l Servlet:创建PageBean对象,给PageBean所有的属性赋值,然后传递给页面;

      Servlet需要给DAO传递pcps

    Dao:

    • trselect count(*) t_customer
    • beanListselect * from t_customer limit x, y
    • 分工图:

    显示分页页码列表
    1 2 3 4 5 6 7 8 9 10
        最多显示多少个页码!定为10;
        当前页,在页码列表中的位置,定为6;
    
    只需要当前页码来定出来页码列表!
    定下来页码列表只需要两样数据:
            begin
            end
    10 11 12 13 14 (15) 16 17 18 19
    需要使用pc来推算出begin和end
    begin = pc – 5
    end = pc + 4
    计算公式:
        如果总页数<=10(列表长度),那么begin=1,end=总页数
        使用公式计算;begin=pc-5, end=pc + 4;
        头溢出:当begin<1时,让begin=1
        尾溢出:当end>${tp}时,让end=${tp}

    3,在超链接中药保留参数:

        当使用多条件查询后,然后在点击第页时,这个第2页超链接没有条件了,所以会丢失条件,所以我们需要在页面上的所有链接都要保留条件!

        我们要把条件以一个字符串的形式保存到PageBeanurl中!这个任务交给Servlet

  • 相关阅读:
    装饰器
    函数对象与闭包
    名称空间与作用域
    函数的参数
    函数的基本使用
    ${}与#{}的区别
    thymeleaf之日期格式化
    template might not exist or might not be accessible by any of the configured Template Resolvers
    springboot使用@Scheduled之cron表达式详解
    自定义springboot项目启动图案
  • 原文地址:https://www.cnblogs.com/xiaoxiao5ya/p/4918101.html
Copyright © 2011-2022 走看看