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%
相关文档:
JSP基本语法
大部分JSP被一个以“<%” 开头和以“%>”结尾的的标记括在其中。在更新的JSP 1.1规范出台后,就有了与XML兼容的版本。
JSP指令和脚本元素
Directives <%@ directive %>
Declarations <%! declaration %>
Expressions <%= expression %>
Code Fragment/ ......
安装:
运行G:\install\setup.exe安装Oracle,但不创建启动数据库
创建数据库(使用Configuration And Migration Tools->DataBase Configuration Assistant)
创建监听程序(使用Configuration And Migration Tools->NetManager或者 Configuration And Migration Tools->Net Configuration Assistant)
创建服务 ......
PL/SQL-FOR UPDATE 与 FOR UPDATE OF的区别
url:http://hi.baidu.com/1413/blog/item/a521251f7e5993c4a686696b.html
数据库 oracle for update of 和 for update区别
select * from TTable1 for update 锁定表的所有行,只能读不能写
2 select * from TTable1 wher ......
本译文采用知识共享署名-非商业性使用-相同方式共享 3.0 Unported许可协议发布,转载请保留此信息
译者:马齿苋 | 链接:http://www.dbabeta.com/2010/oracle-sql-server-comparison-i.html
作者:Sadequl Hussain | 原文:http://www.sql-server-performance.com/articles/dba/oracle_sql_server_comparison_p1.aspx
一 ......
begin
for item in (select * from user_constraints a where a.constraint_type = 'R') loop
execute immediate 'alter table ' || item.table_name || ' disable constraint ' || item.constraint_name;
end loop;
end;
/ ......