Jsp + servlet + JavaBean complete example of data paging method

This paper describes the method of data paging with JSP + servlet + JavaBean as an example. Share with you for your reference, as follows:

Here, with the attitude of doing and remembering, record the learning process, learn quickly and forget quickly, for fear of forgetting, for future use. Part of the code used is to find it on the Internet, modify it and add your own understanding. I don't know whether it is original or not. I only make my own learning records.

Usage related: PostgreSQL database, Dom4j, JSP, servlet

1、 The first is the engineering pattern, which provides a global view for readers and themselves to view and use

The idea is:

In config XML file records configuration information to facilitate database change, migration and reuse. DOM4JUtil. Java is used to parse the XML attribute file to obtain the required data PostgreSQL_ Util. Java sub package data connection and database operation pageproperties Java is the table paging property JavaBean pageproperties Java encapsulates the paging operation page Java is the main paging operation tablepage JSP is the effect display interface

Third party jar packages used:

dom4j-1.6. 1. Jar is used to parse the XML file postgresql-9.3-1101 jdbc4. Jar is used for JDBC connection to PostgreSQL database

The paging effect is as follows: you can turn the page by clicking the previous page and the next page, and enter the specified page to jump (jump to the first or last page beyond the range). Please refer to the detailed code for the specific implementation, which I have posted. I'm a green bird. I'm in the learning stage. Of course, it's better to have the guidance of the great God. I hope you can give me some advice!

2、 Specific code implementation

1、config. XML database connection information attribute file

2、DOM4JUtil. java

3、Postgresql_ Util. java

4、PageProperties. java

5、TablePage. java

6、Page. Java, which is the main processing class, servlet

7、tablePage. JSP foreground display effect

Initially, I feel that the background code is really cumbersome, but this takes into account the robustness and portability of the program to facilitate code reuse. For future use, configure the relevant jdbc driver in the property file (config. XML) according to your own needs, obtain the forwarding result ("result") of the background servlet (page. JSP) through request on the JSP page, and combine the page properties (pageproperties. Java class) to achieve the effect.

Of course, this is also because individual learning tends to use more things.

I hope this article will help you in JSP programming.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>