欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

Spring MVC下 bootStrap服务器分页代码

程序员文章站 2024-03-04 13:01:35
因为spring 对于ajax直接返回对象,到了web页面就转换成json 所以不需要使用json转换封装可以直接使用 

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

<span style="white-space:pre"> </span>@requestmapping(value = "/searchlist.cqzk") 
  @responsebody 
  public bootpage<illegalparkinfo> search(bootpage<illegalparkinfo> page,httpservletrequest request,httpservletresponse response,httpsession session)  
      throws servletexception,ioexception,runtimeexception{ 
    object obj=session.getattribute("page"); 
    bootpage<illegalparkinfo> pagger=(bootpage<illegalparkinfo>) obj; 
    pagger.setsearchfield(page.getsearchfield()); 
    pagger.setsearchtext(page.getsearchtext()); 
    illegalparkinfoservice.bootstrapsearch(pagger); 
    session.setattribute("page", pagger); 
    return pagger;  
  } 

对应的bootpage类 

public final class bootpage<t> { 
  protected int total; 
  protected list<t> rows; 
  protected int limit=10; 
  protected int offset = 0; 
  protected string order ="asc" ; 
  protected string searchtext=null; 
  protected string searchfield=null; 
  public int gettotal() { 
    return total; 
  } 
  public void settotal(int total) { 
    this.total = total; 
  } 
  public list<t> getrows() { 
    return rows; 
  } 
  public void setrows(list<t> rows) { 
    this.rows = rows; 
  } 
  public int getlimit() { 
    return limit; 
  } 
  public void setlimit(int limit) { 
    this.limit = limit; 
  } 
  public int getoffset() { 
    return offset; 
  } 
  public void setoffset(int offset) { 
    this.offset = offset; 
  } 
  public string getorder() { 
    return order; 
  } 
  public void setorder(string order) { 
    this.order = order; 
  } 
  public string getsearchtext() { 
    return searchtext; 
  } 
  public void setsearchtext(string searchtext) { 
    this.searchtext = searchtext; 
  } 
  public string getsearchfield() { 
    return searchfield; 
  } 
  public void setsearchfield(string searchfield) { 
    this.searchfield = searchfield; 
  } 
} 

以上所述是小编给大家介绍的spring mvc下 bootstrap服务器分页代码,希望对大家有所帮助