首页 开发技术 Java     /    jsp+servlet分页

jsp+servlet分页

上传者: a695165987 | 上传时间:2024/5/25 9:24:40 | 文件大小:625KB | 文件类型:rar
jsp+servlet分页
页面的上下两个表单可以封装成一个jsp组件.实现代码的重用具体实现流程如下:客户端的jsp页面传送两个变量:1. Keyword:要查询的关键字2. currentPage:当前要显示第几页servelt中通过调用impl类的方法返回如下内容:1. ArrayList对象:里面存储的是对应的页的数据2. 原样返回currentPage,单击”next”则在此基础之上++;存在(hidden中)3. 原样返回Keyword,下次单击按钮的时候在重新把keyword传过去存在(hidden中)4. 返回根据要搜索的内容,和每页要显示的数量,计算要显示的总页数存在(hidden中)按钮的翻页效果通过js实现下面是next按钮实现代码:window.open("/splitpage/SplitServelt?currentPage="+(page+1)+"&keyword="+keyword,"_self");真分页要注意如下问题:1. PreparedStatement的"?"功能只能充当where条件后面的占位符不能和top一起使用2. 所以在实现分页的时候用了Statement+连接变量的方式完成3. 分页代码如下:selecttop5*frompersonwhereid>(selectmax(id)frompersonwhereidin(selecttop((3-1)*5)idfrompersonwherenamelike'刘%'))分析如下:代码1:selecttop((3-1)*5)idfrompersonwherenamelike'刘%'把前2页数据的id全部找出来查询和”刘”相关的女儿,(3-1)*5代表要显示的是第3页.每页显示5行数据代码2:selectmax(id)frompersonwhereidin(selecttop((3-1)*5)idfrompersonwherenamelike'刘%')重刚刚查询到的id里面选出最大值代码3:selecttop5*frompersonwhereid>(selectmax(id)frompersonwhereidin(selecttop((3-1)*5)idfrompersonwherenamelike'刘%'))要显示5条记录.记录数的id必须大于已经找出来的id(前两页的id)

文件下载

资源详情

[{"title":"(37个子文件625KB)jsp+servlet分页","children":[{"title":"MVC真分页.doc <span style='color:#111;'>30.50KB</span>","children":null,"spread":false},{"title":"splitpage","children":[{"title":".project <span style='color:#111;'>1.20KB</span>","children":null,"spread":false},{"title":".mymetadata <span style='color:#111;'>300B</span>","children":null,"spread":false},{"title":"WebRoot","children":[{"title":"WEB-INF","children":[{"title":"fmt-1_0.tld <span style='color:#111;'>12.29KB</span>","children":null,"spread":false},{"title":"fmt.tld <span style='color:#111;'>19.14KB</span>","children":null,"spread":false},{"title":"sql-1_0-rt.tld <span style='color:#111;'>5.25KB</span>","children":null,"spread":false},{"title":"fmt-1_0-rt.tld <span style='color:#111;'>11.14KB</span>","children":null,"spread":false},{"title":"permittedTaglibs.tld <span style='color:#111;'>1.14KB</span>","children":null,"spread":false},{"title":"web.xml <span style='color:#111;'>801B</span>","children":null,"spread":false},{"title":"scriptfree.tld <span style='color:#111;'>1.68KB</span>","children":null,"spread":false},{"title":"c-1_0-rt.tld <span style='color:#111;'>10.51KB</span>","children":null,"spread":false},{"title":"c-1_0.tld <span style='color:#111;'>11.04KB</span>","children":null,"spread":false},{"title":"x-1_0-rt.tld <span style='color:#111;'>7.03KB</span>","children":null,"spread":false},{"title":"x.tld <span style='color:#111;'>12.00KB</span>","children":null,"spread":false},{"title":"sql.tld <span style='color:#111;'>8.25KB</span>","children":null,"spread":false},{"title":"lib","children":[{"title":"jstl.jar <span style='color:#111;'>17.39KB</span>","children":null,"spread":false},{"title":"jtds-1.2.jar <span style='color:#111;'>278.94KB</span>","children":null,"spread":false},{"title":"standard.jar <span style='color:#111;'>343.11KB</span>","children":null,"spread":false}],"spread":false},{"title":"classes","children":[{"title":"conn","children":[{"title":"DBConn.class <span style='color:#111;'>2.40KB</span>","children":null,"spread":false}],"spread":false},{"title":"dao","children":[{"title":"PersonDAO.class <span style='color:#111;'>290B</span>","children":null,"spread":false}],"spread":false},{"title":"servelt","children":[{"title":"SplitServelt.class <span style='color:#111;'>2.18KB</span>","children":null,"spread":false}],"spread":false},{"title":"vo","children":[{"title":"Person.class <span style='color:#111;'>1.04KB</span>","children":null,"spread":false}],"spread":false},{"title":"impl","children":[{"title":"PersonImpl.class <span style='color:#111;'>3.49KB</span>","children":null,"spread":false}],"spread":false},{"title":"data","children":[{"title":"sql.sql <span style='color:#111;'>2.16KB</span>","children":null,"spread":false}],"spread":false}],"spread":false},{"title":"sql-1_0.tld <span style='color:#111;'>5.98KB</span>","children":null,"spread":false},{"title":"c.tld <span style='color:#111;'>15.62KB</span>","children":null,"spread":false},{"title":"fn.tld <span style='color:#111;'>7.13KB</span>","children":null,"spread":false},{"title":"x-1_0.tld <span style='color:#111;'>7.49KB</span>","children":null,"spread":false}],"spread":false},{"title":"META-INF","children":[{"title":"MANIFEST.MF <span style='color:#111;'>39B</span>","children":null,"spread":false}],"spread":true},{"title":"splitpage.jsp <span style='color:#111;'>3.92KB</span>","children":null,"spread":false}],"spread":true},{"title":".myeclipse","children":null,"spread":false},{"title":"src","children":[{"title":"conn","children":[{"title":"DBConn.java <span style='color:#111;'>1.81KB</span>","children":null,"spread":false}],"spread":true},{"title":"dao","children":[{"title":"PersonDAO.java <span style='color:#111;'>268B</span>","children":null,"spread":false}],"spread":true},{"title":"servelt","children":[{"title":"SplitServelt.java <span style='color:#111;'>2.44KB</span>","children":null,"spread":false}],"spread":true},{"title":"vo","children":[{"title":"Person.java <span style='color:#111;'>545B</span>","children":null,"spread":false}],"spread":true},{"title":"impl","children":[{"title":"PersonImpl.java <span style='color:#111;'>2.59KB</span>","children":null,"spread":false}],"spread":true},{"title":"data","children":[{"title":"sql.sql <span style='color:#111;'>2.16KB</span>","children":null,"spread":false}],"spread":true}],"spread":true},{"title":".classpath <span style='color:#111;'>549B</span>","children":null,"spread":false}],"spread":true}],"spread":true}]

评论信息

  • 雪落成冰:
    值得学习。2015-12-21
  • sugood:
    没用上!写得还可以~支持下2015-09-28
  • 路边小树:
    完美解决了我的问题,谢谢!2015-06-15
  • qq_24366755:
    我已经按照这个实现了!很有帮助2015-01-22
  • u010906096:
    真的很好用2014-10-22

免责申明

【好快吧下载】的资源来自网友分享,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,【好快吧下载】 无法对用户传输的作品、信息、内容的权属或合法性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论 【好快吧下载】 经营者是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。
本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二条之规定,若资源存在侵权或相关问题请联系本站客服人员,8686821#qq.com,请把#换成@,本站将给予最大的支持与配合,做到及时反馈和处理。关于更多版权及免责申明参见 版权及免责申明