json得到数据在jsp页面实现分页


html 页面测试
!DOCTYPE html>

	
		
		
	
	
	
	
	
	
		
id name pass

 
  
dom03.js

$(function(){
	var user={"id":1001,"name":"zh","pass":"pass1"}
	
	var users=[{"id":1001,"name":"zh1","pass":"pass12"},
				{"id":1002,"name":"zh2","pass":"pass31"},
				{"id":1003,"name":"zh3","pass":"pass41"},
				{"id":1004,"name":"zh4","pass":"pass51"},
				{"id":1005,"name":"zh1","pass":"pass12"},
				{"id":1006,"name":"zh2","pass":"pass31"},
				{"id":1007,"name":"zh3","pass":"pass41"},
				{"id":1008,"name":"zh4","pass":"pass51"},
				{"id":1009,"name":"zh1","pass":"pass12"},
				{"id":10010,"name":"zh2","pass":"pass31"},
				{"id":10011,"name":"zh3","pass":"pass41"},
				{"id":10012,"name":"zh4","pass":"pass51"},
				{"id":10013,"name":"zh1","pass":"pass12"},
				{"id":10014,"name":"zh2","pass":"pass31"},
				{"id":10015,"name":"zh3","pass":"pass41"},
				{"id":10016,"name":"zh4","pass":"pass51"}]
	$.each(users, function(index,obj) {
		var nun=$("#all").text(Math.ceil(index/4));
		var s=parseInt(nun);
		var nun1=$("#all").text();
		alert(s+"**********");;
		var s=parseInt(nun1);
		alert(s+"**********"+nun1);
		var num=4;
		var x=1;
		$("#now").text(x);
		if(index<4)	{
			var str=""+""+obj.id+""+
		""+obj.name+""+""+obj.pass+""+"";
		$("tbody").append(str);
		}
	});
	
	$("#btn").click(function(){
		$("tbody").empty();
		index=4;
		var num1=$("#now").text();
		var num2=parseInt(num1)+1;
		    num2=num2*4;
		    var i=num1*4;
		$("#all").text(Math.ceil(users.length/4));	
		if(num1<(users.length/4)){
			$("#now").text(parseInt(num1)+1);
			for(i;i"+users[i].id+""+
			""+users[i].name+""+""+users[i].pass+""+"";
			$("tbody").append(str);
			}
		}else{
			num1=3;
			$("#now").text(parseInt(num1)+1);
			for(var i=4*num1;i"+users[i].id+""+
			""+users[i].name+""+""+users[i].pass+""+"";
			$("tbody").append(str);
			}
		}
	});
	$("#btn1").click(function(){
		$("tbody").empty();
		index=4;
		var num1=$("#now").text();
		var num2=parseInt(num1)+1;
		    num2=num2*4-4;
		    var i=num1*4-4;
		$("#all").text(Math.ceil(users.length/4));	
		if(num1>1){
			$("#now").text(parseInt(num1)-1);
			for(i;i"+users[i].id+""+
			""+users[i].name+""+""+users[i].pass+""+"";
			$("tbody").append(str);
			}
		}else{
			num1=1;
			$("#now").text(num1);
			for(var i=0;i<4;i++){
				str=""+""+users[i].id+""+
			""+users[i].name+""+""+users[i].pass+""+"";
			$("tbody").append(str);
			}
		}
	});
	
});
 
  

jsp
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>





无标题文档











	
位置:
  • 设置
员工合同管理
编号 各种操作 路径 服务者 时间
1256条记录,共有 页 当前
提示信息

是否确认对信息的修改 ?

如果是请点击确定按钮 ,否则请点取消。
 
提示信息

是否确认对信息的修改 ?

如果是请点击确定按钮 ,否则请点取消。
 



你可能感兴趣的:(前台)