日期:2014-05-16 浏览次数:20680 次
var pageNo=0;
$(function(){
//initData(0);
$("#Pagination").pagination(4 //总页数是4, {
callback: pageselectCallback, 回调函数,没有机会执行
prev_text: '<< 上一页',
next_text: '下一页 >>',
items_per_page:10,
num_display_entries:6,
current_page: pageNo,
num_edge_entries:2
});
function pageselectCallback(pageindex,jq) {
initData(pageindex); //翻页的函数
}
function initData(pageNo){
$.ajax({
type:"post",
url:"go.action",
async:false,
data:"pageNo="+(pageNo+1)+"",
success:function(data){
if(data){
var c=eval("("+data+")");
for(var k=0;k<c.length;k++){
$("#body").append("<tr><td>"+c[k].pid+"</td><td>"+c[k].mname+"</td></tr>");
}
}
}
});
}
});
</script>
<link rel="stylesheet" type="text/css" href="css/pagination.css">
</head>
<body>
<table>
<thead><tr><th>编号</th><th>姓名</th></tr></thead>
<tbody id="body"></tbody>
</table>
<div id="Pagination" class="pagination"></div>
</body>
</html>
@Override
public String execute() throws Exception {
Databean a=new Databean();
pageCount=a.count();
return SUCCESS;
}