欢迎光临
我们一直在努力

推出weblogic+oracle 分页-JSP教程,Jsp/Servlet

建站超值云服务器,限时71元/月

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;i<pages;i++) {
   if(startrecord == i*recordperpage) {
    shortkeystr = shortkeystr + "<font size=+1>";   //    被选中页数字字体增大
    shortkeystr = shortkeystr + href + "?startrecord=" + integer.tostring(i*recordperpage) + ">";
    shortkeystr = shortkeystr + integer.tostring(i+1) + "</a></font>" + "\n";
     }else {
   shortkeystr = shortkeystr + href + "?startrecord=" + integer.tostring(i*recordperpage) + ">";
   shortkeystr = shortkeystr + integer.tostring(i+1) + "</a>" + "\n";
   }
   }
  }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;x<dsetsize;x++){
      record 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 + "<tr><td bgcolor=#e1dfd2>" + href1 + "?item=";
     newsstr = newsstr + xinxibm + ">" ;
     newsstr = newsstr + biaot + "</a></td>";
     newsstr = newsstr + "<td bgcolor=#e1dfd2>" + href2 + "?item1=";
     newsstr = newsstr + xinxibm +">普通新闻</a>";
     newsstr = newsstr + "  " + href3 + "?item1=";
     newsstr = newsstr + xinxibm + ">头条新闻</a></td>";
     newsstr = newsstr + "<td bgcolor=#e1dfd2 >" + zy + "</td></tr>";
      }
      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;
   }

}

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » 推出weblogic+oracle 分页-JSP教程,Jsp/Servlet
分享到: 更多 (0)

相关推荐

  • 暂无文章