MyBatis Paging +springmvc+jsp+maven Use steps

Source: Internet
Author: User

This article is mainly used for individual study and review. Welcome to guide, discuss

1, add maven dependency
<dependency>
<groupId>com.github.miemiedev</groupId>
<artifactId>mybatis-paginator</artifactId>
<version>1.2.17</version>
</dependency>

2. Add a paging plugin to the configuration file
<plugin interceptor= "Com.github.miemiedev.mybatis.paginator.OffsetLimitInterceptor" >
<property name= "Dialectclass" value= "Com.github.miemiedev.mybatis.paginator.dialect.MySQLDialect"/>
</plugin>
adding interceptors to the 3,SPRINGMVC configuration file(Purpose: To remove the paginator containing pagelist in ServletRequest and Modelandview and to establish a property named the +paginator suffix of the original property name)
<mvc:interceptor>
<mvc:mapping path= "/**"/>
<bean
class= "Com.github.miemiedev.mybatis.paginator.springmvc.PageListAttrHandlerInterceptor"/>
</mvc:interceptor>
4, the code implementation:
Controller:list<a> Lista=getabypage (classa,new pagebounds (page, limit, order.formstring ("A.asc,b.desc")); /"," Split to sort multiple columns, but where A and B are attributes or fields?
ServiceImpl:Adao.getAByPage (Classa,pagebounds);
Interfacedao: @Select ("* * *") | @SelectProvider
List<a> getabypage (classa,pagebounds);
5, Page call: (Collection +paginator. Properties)
Prev: ${listapaginator.prepage}
Current page: ${listapaginator.page}
Next: ${listapaginator.nextpage}
Total Pages: ${listapaginator.totalpages}
Total number of bars: ${listapaginator.totalcount}

Reference article: http://blog.csdn.net/z69183787/article/details/48947623 (I do not know whether the original)

Individual issues to be resolved:
1,step4 A, B is a field name or a class property?
2, can you integrate with Elasticsearch query? Because Elasticsearchtemplate.queryforlist (Searchquery.build (), classa.class); This method series overload does not seem to set the PageBounds parameter, or somewhere else to pass in it?

MyBatis Paging +springmvc+jsp+maven Use steps

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.