一聚教程网:一个值得你收藏的教程网站

热门教程

Spring MVC下 bootStrap服务器分页代码

时间:2022-06-25 08:47:04 编辑:袖梨 来源:一聚教程网

因为Spring 对于ajax直接返回对象,到了WEB页面就转换成json 所以不需要使用JSON转换封装可以直接使用

 

 代码如下复制代码

@RequestMapping(value ="/searchList.cqzk")

  @ResponseBody

  publicBootPagesearch(BootPagepage,HttpServletRequest  request,HttpServletResponse response,HttpSession session) 

      throwsServletException,IOException,RuntimeException{

    Object obj=session.getAttribute("page");

    BootPagepagger=(BootPage) obj;

    pagger.setSearchfield(page.getSearchfield());

    pagger.setSearchText(page.getSearchText());

    illegalParkInfoService.bootstrapSearch(pagger);

    session.setAttribute("page", pagger);

    returnpagger; 

  }

 

对应的BootPage类

 

 代码如下复制代码

publicfinalclassBootPage{

  protectedinttotal;

  protectedListrows;

  protectedintlimit=10;

  protectedintoffset =0;

  protectedString order ="asc";

  protectedString searchText=null;

  protectedString searchfield=null;

  publicintgetTotal() {

    returntotal;

  }

  publicvoidsetTotal(inttotal) {

    this.total = total;

  }

  publicListgetRows() {

    returnrows;

  }

  publicvoidsetRows(Listrows) {

    this.rows = rows;

  }

  publicintgetLimit() {

    returnlimit;

  }

  publicvoidsetLimit(intlimit) {

    this.limit = limit;

  }

  publicintgetOffset() {

    returnoffset;

  }

  publicvoidsetOffset(intoffset) {

    this.offset = offset;

  }

  publicString getOrder() {

    returnorder;

  }

  publicvoidsetOrder(String order) {

    this.order = order;

  }

  publicString getSearchText() {

    returnsearchText;

  }

  publicvoidsetSearchText(String searchText) {

    this.searchText = searchText;

  }

  publicString getSearchfield() {

    returnsearchfield;

  }

  publicvoidsetSearchfield(String searchfield) {

    this.searchfield = searchfield;

  }

}

 

热门栏目