|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
java主要分三块,j2se:java的基础核心语言。j2me:java的微型模块,专门针对内存小,没有持续电源等小型设备。j2ee:java的企业模块,专门针对企业数据库服务器的连接维护。oracle|web|分页importjava.sql.*;
importjava.util.*;
importweblogic.db.jdbc.*;
publicclassbandlistBean{
privateStringdriver;
privateStringdbURL;
privateBean2b=newBean2();
publicbandlistBean(){
globalBeanglobalstr=newglobalBean();
driver=globalstr.getDBDriver();
dbURL=globalstr.getDBURL();
}
publicStringgetKey(Stringhref,intrecordPerPage,intstartRecord){
Connectionconn=null;
QueryDataSetdSet=null;
Stringshortkeystr="";
try{
Class.forName(driver).newInstance();
conn=DriverManager.getConnection(dbURL);
Stringcountsql="Selectcount(*)ascountfromTABLEwhereyijlmbm=1andriq=to_char(sysdate,yyyymmdd)";
dSet=newQueryDataSet(conn,countsql);
dSet.fetchRecords();
RecordcountRecord=dSet.getRecord(0);
intdSetAllSize=countRecord.getValue("count").asInt();
intpages=dSetAllSize/recordPerPage;
if(dSetAllSize%recordPerPage!=0)pages++;
for(inti=0;i<pages;i++){
if(startRecord==i*recordPerPage){
shortkeystr=shortkeystr+"<Fontsize=+1>";//被选中页数字字体增年夜
shortkeystr=shortkeystr+href+"?startRecord="+Integer.toString(i*recordPerPage)+">";
shortkeystr=shortkeystr+Integer.toString(i+1)+"</a></Font>"+"
";
}else{
shortkeystr=shortkeystr+href+"?startRecord="+Integer.toString(i*recordPerPage)+">";
shortkeystr=shortkeystr+Integer.toString(i+1)+"</a>"+"
";
}
}
}catch(Exceptione){System.out.println("Exception:"+e);}
finally{
if(dSet!=null)try{dSet.close();}catch(Exceptione){}
if(conn!=null)try{conn.close();}catch(Exceptione){}
}
returnshortkeystr;
}
publicStringgetYjlmList(Stringhref1,Stringhref2,Stringhref3,intrecordPerPage,intstartRecord){
Stringnewsstr="";
Connectionconn=null;
QueryDataSetdSet=null;
Stringzy="";
try{
Class.forName(driver).newInstance();
conn=DriverManager.getConnection(dbURL);
Stringsqlstr="Selectxinxibm,biaot,weightfromxinxwhereyijlmbm=1andriq=to_char(sysdate,yyyymmdd)orderbyxinxibmdesc";
dSet=newQueryDataSet(conn,sqlstr);
dSet.fetchRecords(startRecord,recordPerPage);
intdSetSize=dSet.size();
for(intx=0;x<dSetSize;x++){
RecordcurRecord=dSet.getRecord(x);
Stringxinxibm=newInteger(curRecord.getValue("xinxibm").asInt()).toString().trim();
Stringbiaot=b.x2u(curRecord.getValue("biaot").asString().trim());
Stringweight=newInteger(curRecord.getValue("weight").asInt()).toString().trim();
if(weight.compareTo("1")==0){
zy="主要旧事";
}else{
zy="一般旧事";
}
newsstr=newsstr+"<tr><tdbgcolor=#E1DFD2>"+href1+"?Item=";
newsstr=newsstr+xinxibm+">";
newsstr=newsstr+biaot+"</a></td>";
newsstr=newsstr+"<tdbgcolor=#E1DFD2>"+href2+"?Item1=";
newsstr=newsstr+xinxibm+">一般旧事</a>";
newsstr=newsstr+""+href3+"?Item1=";
newsstr=newsstr+xinxibm+">头条旧事</a></td>";
newsstr=newsstr+"<tdbgcolor=#E1DFD2>"+zy+"</td></tr>";
}
dSet.close();
conn.close();
}catch(Exceptione){}
finally{
if(dSet!=null)try{dSet.close();}catch(Exceptione){}
if(conn!=null)try{conn.close();}catch(Exceptione){}
}
returnnewsstr;
}
}
首先java功能强大的背后是其复杂性,就拿web来说,当今流行的框架有很多,什么struts,spring,jQuery等等,而这无疑增加了java的复杂性。 |
|