因为Spring 对于ajax直接返回对象,到了WEB页面就转换成json 所以不需要使用JSON转换封装可以直接使用
代码如下 | 复制代码 |
@RequestMapping(value ="/searchList.cqzk") @ResponseBody publicBootPage throwsServletException,IOException,RuntimeException{ Object obj=session.getAttribute("page"); BootPage pagger.setSearchfield(page.getSearchfield()); pagger.setSearchText(page.getSearchText()); illegalParkInfoService.bootstrapSearch(pagger); session.setAttribute("page", pagger); returnpagger; } |
对应的BootPage类
代码如下 | 复制代码 |
publicfinalclassBootPage protectedinttotal; protectedList protectedintlimit=10; protectedintoffset =0; protectedString order ="asc"; protectedString searchText=null; protectedString searchfield=null; publicintgetTotal() { returntotal; } publicvoidsetTotal(inttotal) { this.total = total; } publicList returnrows; } publicvoidsetRows(List 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; } } |