Spring MVC下 bootStrap服务器分页代码

因为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服务器分页代码,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对网站的支持!

若文章对您有帮助,帮忙点个赞!

0
0
发布时间 2017-03-10 11:41:48
0 条回复(回复会通过微信通知作者)
点击加载更多评论
登录 后再进行评论
(微信扫码即可登录,无需注册)