详细的jsp分页(oracle+jsp+apache)

你杯具了了

你杯具了了

2016-02-19 20:18

下面是个简单易学的详细的jsp分页(oracle+jsp+apache)教程,图老师小编详细图解介绍包你轻松学会,喜欢的朋友赶紧get起来吧!

  我的一个详细的jsp分页程序!(oracle+jsp+apache)
  一 前提
  希望最新的纪录在开头给你的表建立查询:
  表:mytable
  查询:create or replace view as mytable_view from mytable order by id desc 其中,最好使用序列号create sequence mytable_sequence 来自动增加你的纪录id号

  二 源程序
  %String sConn="你的连接"
  Class.forName("oracle.jdbc.driver.OracleDriver");
  Connection conn=DriverManager.getConnection(sConn,"你的用户名","密码");
  Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
  Statement stmtcount=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);

  ResultSet rs=stmt.executeQuery("select * from mytable_view");
  String sqlcount="select count(*) from mytable_view";
  ResultSet rscount=stmtcount.executeQuery(sqlcount);

(本文来源于图老师网站,更多请访问https://m.tulaoshi.com/webkaifa/)

  int pageSize=你的每页显示纪录数;
  int rowCount=0; //总的记录数
  while (rscount
  int pageCount; //总的页数
  int currPage; //当前页数
  String strPage;
  strPage=request.getParameter("page");
  if (strPage==null){
  currPage=1;
  }
  else{
  currPage=Integer.parseInt(strPage);
  if (currPage1) currPage=1;
  }
  pageCount=(rowCount+pageSize-1)/pageSize;
  if (currPagepageCount) currPage=pageCount;

  int thepage=(currPage-1)*pageSize;
  int n=0;
  rs.absolute(thepage+1);
  while (n(pageSize)&&!rs
  %
  %rs.close();
  rscount.close();
  stmt.close();
  stmtcount.close();
  conn.close();
  %

(本文来源于图老师网站,更多请访问https://m.tulaoshi.com/webkaifa/)

  //下面是 第几页等
  form name="sinfo" method="post" action="sbinfo_index.jsp?condition=%=condition%&type=%=type%" onSubmit="return testform(this)"
  第%=currPage%页 共%=pageCount%页 共%=rowCount%条
  %if(currPage1){%a href="sbinfo_index.jsp?condition=%=condition%&type=%=type%"首页/a%}%
  %if(currPage1){%a href="sbinfo_index.jsp?page=%=currPage-1%&condition=%=condition%&type=%=type%"上一页/a%}%
  %if(currPagepageCount){%a href="sbinfo_index.jsp?page=%=currPage+1%&condition=%=condition%&type=%=type%"下一页/a%}%
  %if(pageCount1){%a href="sbinfo_index.jsp?page=%=pageCount%&condition=%=condition%&type=%=type%"尾页/a%}%
  跳到input type="text" name="page" size="4" style="font-size:9px"页
  input type="submit" name="submit" size="4" value="GO" style="font-size:9px"
  /form 
   

   完

展开更多 50%)
分享

猜你喜欢

详细的jsp分页(oracle+jsp+apache)

Web开发
详细的jsp分页(oracle+jsp+apache)

jsp hibernate的分页代码

Web开发
jsp hibernate的分页代码

s8lol主宰符文怎么配

英雄联盟 网络游戏
s8lol主宰符文怎么配

高效的jsp分页查询

Java JAVA基础
高效的jsp分页查询

jsp分页技术代码奉献

Web开发
jsp分页技术代码奉献

lol偷钱流符文搭配推荐

英雄联盟 网络游戏
lol偷钱流符文搭配推荐

代码实例:JSP分页源程序

Web开发
代码实例:JSP分页源程序

JSP数据库操作例程 - 数据分页显示 - JDBC 2.0 - Oracle

Java JAVA基础
JSP数据库操作例程 - 数据分页显示 - JDBC 2.0 - Oracle

lolAD刺客新符文搭配推荐

英雄联盟
lolAD刺客新符文搭配推荐

优化Oracle停机时间及数据库恢复

优化Oracle停机时间及数据库恢复

将回收站直接"请"到任务栏 还你清爽桌面

将回收站直接"请"到任务栏 还你清爽桌面
下拉加载更多内容 ↓