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);
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 (currPage<1) currPage=1;
}
pageCount=(rowCount+pageSize-1)/pageSize;
if (currPage>;pageCount) 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();
%>;
//下面是 第几页等
<form name="sinfo" method="post" action="sbinfo_index.jsp?condition=<%=condition%
相关文档:
1.添加 host 块
每一个JSP虚拟主机有它自己的 host 块。每一个至少要定义id来指定虚拟主机的名字和一个root应用程序。一个 <root-directory>通常用来为主机定一个默认的web应用程序。
配置文件片段:
<server>
<host id='gryffindor.caucho.com'>
<root-directory>/home/www/gryf ......
(1)oracle数据库备份的导入对数据库的版本有要求,也即源数据库(导出产生备份的数据库)的版本要和目标数据库(导入数据库)的版本一致,否则可能导致导入失败。
(2)备份中的用户名(数据库导出时所使用的用户)和导入数据库的用户名最好一样,因为用户名和表空间命名有关系,如果不一样,导入就不能一次完成。也就是 ......
Oracle9i Database Release 2 Enterprise/Standard/Personal Edition for Windows NT/2000/XP
http://download.oracle.com/otn/nt/oracle9i/9201/92010NT_Disk1.zip
http://download.oracle.com/otn/nt/oracle9i/9201/92010NT_Disk2.zip
http://download.oracle.com/otn/nt/oracle9i/9201/92010NT_Disk3.zip
Oracle9i ......
安装:
运行G:\install\setup.exe安装Oracle,但不创建启动数据库
创建数据库(使用Configuration And Migration Tools->DataBase Configuration Assistant)
创建监听程序(使用Configuration And Migration Tools->NetManager或者 Configuration And Migration Tools->Net Configuration Assistant)
创建服务 ......