ajax分页查询jsp spring,eclipse中分页问题 springmvc+springdate jsp +hibernate+spring

这篇博客介绍了如何在Java后台使用@RequestMapping实现分页查询功能,通过PageModel返回查询结果。同时展示了前端JSP页面如何通过jQuery的ajax方法调用后台接口,并使用template插件展示数据。在遇到查询失败的情况时,返回错误信息提示用户。
摘要由CSDN通过智能技术生成

这是后台控制层的分页代码

@RequestMapping("/findcustomer")//实现分页查询

@ResponseBody

public MyAjaxResult findCustomer(Integer adminId,String search,Integer currentPage,Integer pageSize){

PageModel pageModel;

try {

pageModel = cusService.findList(adminId,search,currentPage,pageSize);

return MyAjaxResult.success(pageModel);

} catch (Exception e) {

e.printStackTrace();

return MyAjaxResult.fail_300("查询失败");

}

}

怎样在JSP页面这段代码实现分页查询

getCustomerListAjax();//模糊查询和查看全部

function getCustomerListAjax(cur) {

$.ajax({

url:"${pageContext.request.contextPath}/loginAction/get_customerList",

type:"post",

data:$("#seachForm").serialize(),

dataType:"json",

success: function(data){

if(data.code==200){

console.log(data);

$('#courseTypeWrap').html(template('courseTypeTest', data));

}else{

layer.open({

title: '警告!',

content: data.msg

,yes: function(index, layero){

//按钮【按钮一】的回调

window.location.href="${pageContext.request.contextPath}/loginAction/login"

}

});

}

}

});

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值