An example of paging using hibernate and struts 2
Thinking of learning a new thing every day, I prepared this hibernate + struts 2 to realize the page paging function. The following is the source code.
1. The design of Dao layer interface defines a persondao interface, which declares two methods:
2. The implementation class of Dao layer interface, persondaoimpl class, implements its two methods:
3. Define a pagebean (the content required for each page is stored in this pagebean), which is used to store the content displayed on each page of the web page:
4. Service layer interface design defines a personservice interface, which declares a method and returns a pagebean:
5. The service layer interface implementation class, personserviceimpl class, implements the only method:
6. The action layer is designed to define a personaction:
7. Auxiliary class design, hibernateutil:
8. Finally, the paging page displays pageperson jsp:
So far, the code part of Hibernate + struts 2 to realize web page paging function is completed. The configuration files such as hibernate and struts are not listed. Those are not the focus!
The page effect is as follows:
The above is the whole content of this article. I hope it will be helpful to your study, and I hope you can support programming tips.