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)