Jsp前端公共分页实现!!!

来源:互联网 发布:mysql 建库 utf8 编辑:程序博客网 时间:2024/05/17 07:06


page.js


$(function(){$("#firstPage").click(function(){$("input[name='hidden']").val(1);queryByPage();});$("#lastPage").click(function(){$("input[name='hidden']").val($("#totalPage").text());queryByPage();});$("#previousPage").click(function(){var currentPage = $("input[name='hidden']").val();if(currentPage>1){currentPage--;$("input[name='hidden']").val(currentPage);queryByPage();}});$("#nextPage").click(function(){var currentPage = $("input[name='hidden']").val();if(currentPage<$("#totalPage").text()){currentPage++;$("input[name='hidden']").val(currentPage);queryByPage();}});})


results.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%><%String path = request.getContextPath();String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";%>        <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head><base href="<%=basePath%>"><script type="text/javascript" src="scripts/jquery-1.8.2.min.js"></script><script type="text/javascript" src="scripts/page.js"></script><script type="text/javascript">function queryByPage(){var currentPage = $("input[name='hidden']").val();$("#rightFdr").load("mediafirst/projectList.htm",{"method" : "show","starttime" : "${starttime}","endtime" : "${endtime}","lowprice" : "${lowprice}","highprice" : "${highprice}",//这四个都是参数"currentPage":currentPage//当前页数});}</script></head><body><div id="rightFdr"><div class="topbox">                <div><ul><td colspan="4" class="fenye">共<span id="totalPage">${page.pageCount}</span>页  当前第<span id="currentPage">${page.currentPage}/${page.pageCount}</span>页  <a href="javascript:void(0);" id="firstPage">首页</a>  <a href="javascript:void(0);" id="previousPage">上一页</a>  <a href="javascript:void(0);" id="nextPage">下一页</a>  <a href="javascript:void(0);" id="lastPage">末页</a></td></ul></div></div></div></body></html>


0 0
原创粉丝点击