APP下载

JSP开发环境下的数据分页技术探讨

2021-05-09潘国荣

现代信息科技 2021年20期

摘  要:数据分页是用JSP开发Web应用程序时经常要用到的一种技术。在页面上要展示从数据库中取出的大量数据时,就需要对数据进行分页处理,分页处理主要涉及待分页的记录数据的获取、记录总数和总页数的计算、每页记录数的设定、当前页数据的存放等,这在不同的开发模式下处理过程是有区别的。文章对在JSP开发环境中三种不同开发模式下的数据分页方法进行了探讨。

关键词:JSP;开发模式;数据分页技术

中图分类号:TP311                    文献标识码:A文章编号:2096-4706(2021)20-0033-03

Discussion on Data Paging Technology under JSP Development Environment

PAN Guorong

(Changzhou Liu Guojun Vocational Technology College, Changzhou  213025, China)

Abstract: Data paging is a technology often used when developing Web applications with JSP. When you want to display a large amount of data taken from the database on the page, you need to page the data. The paging processing mainly involves the acquisition of the record data to be paged, the calculation of the total number of records and total pages, the setting of the number of records per page, the storage of the current page data, etc. the processing process is different under different development modes. This paper discusses the data paging methods under three different development modes in JSP development environment.

Keywords: JSP; development mode; data paging technology

0  引  言

JSP技术是现在常用的一种开发动态网站的技术,在开发实际应用程序时,经常要将数据库中大量的数据取出后展示在页面上,这就需要对数据进行分页处理,否则页面上要显示的数据可能远远超出一个页面范围,应用程序界面对用户来讲就不太友好。本文根据本人开发的一个在教学中已实际使用的案例-学生成绩基本信息维护系统为例,对基于不同的JSP开发模式下数据的分页处理方法进行分析和论述。

1  数据分页处理概述

数据分页就是将数据从后台数据库中查询出来之后按用户需要进行分页显示,每一页上显示一定数量的记录数据,使得数据的展示更加符合用户需要,清晰、美观合理。这时,我们可以用分页技术。下面我们以学生信息维护系统中学生数据的分页为例进行说明。程序运行时页面中数据分页情况如图1所示。

数据库的设计比较簡单,只要在其中设计一张学生基本信息表即可,表名为studenttb,表结构如表1所示。……

登录APP查看全文