推出weblogic+oracle分页

import java.sql.*;
import java.util.*;
import weblogic.db.jdbc.*;

public class bandlistBean {
private String driver;
private String dbURL;
private Bean2 b=new Bean2();

public bandlistBean(){
globalBean globalstr = new globalBean();
driver = globalstr.getDBDriver();
dbURL = globalstr.getDBURL();
}

public String getKey(String href,int recordPerPage,int startRecord) {
Connection conn = null;
QueryDataSet dSet = null;
String shortkeystr ="";
try{
Class.forName(driver).newInstance();
conn=DriverManager.getConnection(dbURL);
String countsql = "Select count(*) as count from TABLE where yijlmbm=1 and riq=to_char(sysdate,´yyyymmdd´)";
dSet = new QueryDataSet(conn,countsql);
dSet.fetchRecords();
Record countRecord = dSet.getRecord(0);
int dSetAllSize = countRecord.getValue("count").asInt();

int pages = dSetAllSize/recordPerPage;
if(dSetAllSize%recordPerPage !=0) pages++;
for(int i=0;iif(startRecord == i*recordPerPage) {
shortkeystr = shortkeystr + " "; // 被选中页数字字体增大
shortkeystr = shortkeystr + href + "?startRecord=" + Integer.toString(i*recordPerPage) + ">";
shortkeystr = shortkeystr + Integer.toString(i+1) + "" + " ";
}else {
shortkeystr = shortkeystr + href + "?startRecord=" + Integer.toString(i*recordPerPage) + ">";
shortkeystr = shortkeystr + Integer.toString(i+1) + "" + " ";
}
}
}catch(Exception e) { System.out.println("Exception:"+e);}
finally{
if (dSet!= null) try {dSet.close();}catch(Exception e){}
if (conn!= null) try {conn.close();}catch(Exception e){}
}
return shortkeystr;
}

public String getYjlmList(String href1,String href2,String href3,int recordPerPage,int startRecord) {
String newsstr = "";
Connection conn = null;
QueryDataSet dSet = null;
String zy="";
try {
Class.forName(driver).newInstance();
conn=DriverManager.getConnection(dbURL);
String sqlstr = "Select xinxibm,biaot,weight from xinx where yijlmbm=1 and riq=to_char(sysdate,´yyyymmdd´) order by xinxibm desc";
dSet = new QueryDataSet(conn,sqlstr);
dSet.fetchRecords(startRecord,recordPerPage);
int dSetSize = dSet.size();

for(int x=0;xRecord curRecord = dSet.getRecord(x);
String xinxibm = new Integer(curRecord.getValue("xinxibm").asInt()).toString().trim();
String biaot = b.x2u(curRecord.getValue("biaot").asString().trim());
String weight = new Integer(curRecord.getValue("weight").asInt()).toString().trim();
if(weight.compareTo("1")==0){
zy="重要新闻";
}else{
zy="普通新闻";
}
newsstr = newsstr + "" + href1 + "?Item=";
newsstr = newsstr + xinxibm + ">" ;
newsstr = newsstr + biaot + "";
newsstr = newsstr + "" + href2 + "?Item1=";
newsstr = newsstr + xinxibm +">普通新闻";
newsstr = newsstr + " " + href3 + "?Item1=";
newsstr = newsstr + xinxibm + ">头条新闻";
newsstr = newsstr + "" + zy + "";
}
dSet.close();
conn.close();
}catch(Exception e) {}
finally{
if (dSet!= null) try {dSet.close();}catch(Exception e){}
if (conn!= null) try {conn.close();}catch(Exception e){}
}
return newsstr;
}

} [@more@]

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/9650775/viewspace-921126/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/9650775/viewspace-921126/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值