Launch Weblogic+oracle Paging

Source: Internet
Author: User
Tags count integer tostring trim
oracle|web| pagination 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>"; The selected page digital font is enlarged
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 Xinxib M 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= "Important News";
}else{
Zy= "Ordinary News";
}
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 + "> General news </a>";
Newsstr = Newsstr + "" + HREF3 + "? Item1= ";
Newsstr = newsstr + XINXIBM + "> Headline news </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;
}

}

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.