Use Java to implement simple dry special pictures on the web

zhaozj2021-02-16  58

(Table 4) Yes data from the database.

Some of the code in planmanager.java

Public Vector getAllPlan () {

String SQL = "SELECT ID, PRONAME, STALLM, Endallm, Iall, Startdate, Enddate from Plansc ORDER BY ID"; // Get data SQL statement

Vector vec = new vector ();

Try {

THIS.GETCONNECTION ();

Statement st = conn.createstatement ();

ResultSet RS = St.executeQuery (SQL);

While (rs.next ()) {

Hashtable hashcar = new hashtable ();

/ / Get a record

String id = rs.getstring ("id");

String proname =

NEW STRING

Rs.getstring ("proname"). GetBytes ("ISO-8859-1",

"GBK");

String stallm = rs.getstring ("stallm");

String endM = rs.getstring ("endallm");

String IAALL = rs.getstring ("iALL");

String startdate = rs.getstring ("startdate");

String enddate = rs.getstring ("enddate");

// load a record to the hash table

Hashcar.put ("ID", ID);

Hashcar.put ("proname", proname);

Hashcar.put ("stallm", stallm;

Hashcar.put ("endallm", endallm;

Hashcar.put ("IALL", IALL);

Hashcar.put ("startdate", startdate;

Hashcar.put ("enddate", enddate;

// put the hash table to the Vector variable

VEC.AddeElement (hashcar);

}

} catch (exception ex) {

} Finally {

Try {

IF (st! = null) {

St.close ();

}

IF (conn! = null) {

CONN.CLOSE ();

}

Dbconn.closeconn ();

} catch (sqlexception ex) {

System.out.print ("Close Connection Error");

}

}

Return vec; // vector variables Return to the called JSP

}

(Table 4)

(Table 5) Some of the code in jindubiao.jsp, unwalanced data from the number of groups and obtains the second type (adjustment schedule) (with the first type - planning and construction progress)

Some code in jindubiao.jsp, java.lang.string [] [] myall = new java.lang.string [12] [7]; // Declaration array

java.util.Enumeration enuDrivers = vec.elements (); int j = 0; while (enuDrivers.hasMoreElements ()) {java.util.Hashtable hashDriver = (java.util.Hashtable) enuDrivers.nextElement (); String id = (Java.lang.String) HashDriver.get ("id"); string proname = (java.lang.string) hashdriver.get ("proname"); string stallm = (java.lang.string) hashdriver.get (" "STALLM"); String endM = (java.lang.string) HashDriver.get ("endallm"); string Iall = (java.lang.string) hashdriver.get ("IALL"); string startdate = (java.lang. HashDriver.get ("startdate"); string enddate = (java.lang.string) HashDriver.get ("enddate"); myall [j] [0] = id; myall [j] [1] = proname; Myall [J] [2] = stallm; myall [j] [3] = endallm; Myall [J] = IALL; myall [j] [5] = startdate; myall [j] = enddate; j ;} // Get a second type (adjustment schedule), pay attention to getAllPlan2

Vector vec2 = new vector (); vec2 = planc.getallplan2 (); java.lang.string [] [] myall2 = new java.lang.string [12] [7]; java.util.enumeration enudrivers2 = vec2.eferences (); int j2 = 0; while (enuDrivers2.hasMoreElements ()) {java.util.Hashtable hashDriver2 = (java.util.Hashtable) enuDrivers2.nextElement (); String id = (java.lang.String) hashDriver2.get ("ID"); string proname = (java.lang.string) HashDriver2.get ("proname"); string stallm = (java.lang.string) hashdriver2.get ("stallm"); string endallm = (Java. Lang.string) HashDriver2.get ("endallm"); string IALL = (java.lang.string) hashdriver2.get ("IALL"); string startdate = (java.lang.string) HashDriver2.Get ("startdate") String enddate = (java.lang.string) HashDriver2.get ("enddate"); myall2 [j2] [0] = ID; Myall2 [j2] [1] = proname; myall2 [j2] [2] = stallm; myall2 [j2] [3] = endallm; myall2 [j2] [4] = IAll; myall2 [j2] [5] = startdate; Myall2 [j2] [6] = enddate; j2 ;} (Table 5)

转载请注明原文地址:https://www.9cbs.com/read-24660.html

New Post(0)