Code Monkey home page Code Monkey logo

Ginkgo Pagination Library

银杏树分页标签库

image

    这是一个分页标签库,老乔创建于2013年。使用JSP标签的方式,实现了方便快捷地分页功能,内置提供了简单样式分页栏、bootstrap样式分页栏两种内置分页栏样式。
    同时,Ginkgo Pagination 也提供了返回JSON格式的分页栏数据,让使用者自己实现分页栏样式。
    现在直接使用jsp作为前端视图层模板的项目不多了(现在流行用react/vue做前端,后端提供json),我这个也是多年前做的一个小组件,现在开源出来,给仍然使用jsp作为模板的有缘人,或许能提供一些帮助。

预览

    默认分页栏样式

image

    Bootstrap风格的分页栏样式

image

使用说明

    需要配合Ginkgo-JDBC框架,或者Ginkgo-SpringJDBC(稍后开源)框架来使用。

服务端数据对象部分

DefaultPagingContext pagingContext = new DefaultPagingContext(sql, param);
pagingContext.setPageSize(2L);

//paging service 对象,可以手动创建,也可以使用RapidMVC内置的简单DI方式注入,或者使用任何一个你自己的依赖注入框架(比如Spring)来注入。
PagingService pagingService = JdbcPagingService.createInstanceManually();

//执行下面的doPaging(...);方法时,JDBC分页功能模块,已经把分页上下文对象,存入的HttpServletRequest 的Attribute属性中,key是:pagingContext
List dataList = pagingService.doPaging(this.getRequest(), pagingContext, BlogArticle.class);

//dataList是你在视图层便利的数据集列表对象
request.setAttribute("dataList", dataList);

jsp页面部分

第一步:引入jsp标签库

<%@ taglib prefix="i" uri="http://georgeinfo.com/paginationframework/tags" %>

第二步:在要显示分页栏的地方,加入分页标签

<i:jpb renderer="bootstrap" data="${pagingContext}"></i:jpb>

第三步:在页面初始化js代码中,初始化分页栏样式
$(function (){

     //## 分页栏调用JS 开始 ##########################
     paginationBar_func(); //paginationBar是分页栏标签的varName
     //## 分页栏调用JS 结束 ##########################

     //## 分页栏及页面其他气泡弹出框渲染 开始 #########
     $("[data-toggle='popover']").popover();
     //## 分页栏及页面其他气泡弹出框渲染 结束 #########

});

你完全可以自己实现

com.georgeinfo.pagination.context.GenericPagingContext

接口,自己来实现Ginkgo Pagination组件的服务端对象提供机制,不必依赖Ginkgo-JDBC框架,或者Ginkgo-SpringJDBC(稍后开源)框架。

参与及讨论

    欢迎加入《互联网软件之家》QQ群:693203950

image
    有问题,可以到这里来反馈。

George's Projects

ginkgo-di icon ginkgo-di

Simple dependency injection framework(DI/IOC), 一个精简的Java依赖注入框架。

ginkgo-jdbc icon ginkgo-jdbc

A streamlined JDBC framework, simple and less dependent.

hellorpc icon hellorpc

A simple RPC framework,just for experimentation and fun.

rapidmvc icon rapidmvc

A simple Java Web MVC Framework. 一个极简Web MVC框架,给那些想了解WEB MVC知识的同学提供一个参考示例

socket.io icon socket.io

Realtime application framework for Node.JS, with HTML5 WebSockets and cross-browser fallbacks support.

training icon training

算法,设计模式,代码技巧等代码练习

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.