Spring MVC下 bootStrap服务器分页代码

时间:2021-10-13 06:12:57

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

?
1
2
3
4
5
6
7
8
9
10
11
12
<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类 

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
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 MVCbootStrap服务器分页代码,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对服务器之家网站的支持!

原文链接:http://blog.csdn.net/douzi949389/article/details/61191657