日期:2014-05-16 浏览次数:20481 次
//数据源 this.myDataSource = new YAHOO.util.DataSource(URL);
//得到分页内容url function getQueryUrl(page) { var account = document.getElementById("uuser").value; var name = document.getElementById("uname").value; var perPageResults = document.getElementById("perPageResults").value; var backEndUrl = contextPath+"/yuidemo/userManager.do?method=queryByYahoo_1&count=1&account="+account+"&name="+name+"&perPageResults="+perPageResults; if (typeof page != 'undefined'){ backEndUrl +="&page="+page; } return backEndUrl; } //内容显示 jquery ajax异步请求 function content(pageUrl){ $.ajax( { type : "POST", url : pageUrl, cache : false, dataType: "json", success : showContent }); }
// 内容显示 function content(){ var options = { dataType: 'json', url: contextPath+"/yuidemo/userManager.do?method=queryByYahoo_2&count=1", success: showContent }; $('#myForm').ajaxForm(options); $('#myForm').submit(); }
List<UserDTO> list = new ArrayList<UserDTO>(); int page = 1; if (user.getPage() != null && !"".equals(user.getPage())) { page = Integer.parseInt(user.getPage()); } int perPageResults = 10; if (user.getPerPageResults() != null && !"".equals(user.getPerPageResults())) { perPageResults = Integer.parseInt(user.getPerPageResults()); } // ROWNUM rowIndex 从1开始不是从0开始 user.setStartRowNum((long) (page - 1) * perPageResults + 1); user.setEndRowNum((long) page * perPageResults); list = this.userDao.query(user); JSONArray json = new JSONArray(); json.clear(); json = JSONArray.fromObject(list); response.setHeader("X-JSON", json.toString()); response.setCharacterEncoding("UTF-8"); response.setHeader("Cache-Control", "no-cache,must-revalidate");// 清楚缓存 response.setHeader("Pragma", "no-cache"); // HTTP 1.0 response.setDateHeader("Expires", 0); // prevents caching at the // json.put("data", 1); response.getWriter().print(json.toString()); return null;