The effect of paging implementation:
/////////
/////////////////////////////////////////////////////// //////////////////////////////////////////////// //////// ////////////////////////////////////////////////////////////////// ///////////////////////////////////////////// /////////////////////////////////////////
/////
////////////////////
One, from the effect can be seen from two parts of the content:
1. Student Information
2. Page number query (the current page number is the first page or the last page, not clickable, the content will be written in the tab.jsp file)
Second, the main knowledge is:
JDBC database connection, Java Basic class interface and generics knowledge, JSP, Servlet, XML
Third, the platform used here for the MyEclipse database for MySQL (also available other)
SPRINGMVC Architecture MVC (model-view-controller)
Iv. Concrete Implementation
First, the JDBC related operations:
New database MYSQL2, new table student
(1) Information of the table
(2) types and lengths of the properties of the table
////////////
Paging implementation is
Querying the contents of a database table through a server on a browser enables paging
After the table information for the database is processed, create a new Web project
Under/webroot/web-inf/lib, import the jar for the database connection package/webroot/web-inf/lib/mysql-connector-java-5.0.3-bin.jar
New package file name, package name definition (following new class, package, JSP, servlet, etc. named Custom) under SRC
1. Create the class DBO for the platform-to-database connection in the built package Pers.ms.rfeng.util, with the following code:
The new test connection is successful and the code is as follows:
New student class and generic class codes are as follows
////////
/ ////////
The Student information class corresponds to the DAO package
New interface Studentdao, write a method to be implemented by page query content Findbypage (),
At the same time, the new class Studentdaoimpl implements the interface.
The corresponding code is as follows:
Code//////////////////////////////////////to implement the interface
The new class Studentservice class invokes the method of querying content by page.
The code is as follows:
New jump page index.jsp code as follows
Create a new servlet named Studentservlet to handle the reception of commands or data from the view
The code is as follows:
/////////////////////////////////////////
The message that corresponds to the interface that jumps in the studentservlet. A JSP is a view of what the beginning effect shows,
The code is as follows:
/////////////////// where the page number of the Jump bar is tab.jsp,
The code is as follows:
//////////////////
The effect, as shown in the beginning,
Specific page style, like content center, color, add some of their own style, can be in, corresponding to the JSP write the corresponding modification
Java Web Spring MVC paging implementation