(Table 1) The content is both an implementation of the basic algorithm, and the user customers requiring different precision requirements, achieving higher precision requirements. I put the algorithm in the JSP page to adapt to some users who may not use JavaBean habits or not intend to use JavaBean as the next layer. However, this article provides JavaBean as the next layer of object, implements the database connection and access to the database. Please refer to (Table 2).
Part of PLANMANAGER.JAVA PRIVATE CONN = NULL;
Private statement st = NULL;
Private resultset = null;
Private prepaaredStatement PSTMT = NULL;
Public Boolean Updateplan (int Type, String Proname, String Stallm, String Endallm,
String Iall, string startdate, string enddate {
String SQL = ""; // can be implemented SQL statement
This.getConnection (); // Database connection is provided in another place, not a detailed description here
// Type represents different types - select adjustment objects
If (type = = 1) {// Adjust the object according to different selection to adjust the different SQL statements
SQL =
"Update Plansc Set Stallm ="
stallm
", Endallm ="
Endallm
", IALL ="
IAll
", startdate = '"
StartDate
"', Enddate ='"
Enddate
"'where proname ='"
Proname
"'";
} else {
SQL =
"Update Plansc2 Set Stallm ="
stallm
", Endallm ="
Endallm
", IALL ="
IAll
", startdate = '"
StartDate
"', Enddate ='"
Enddate
"'where proname ='"
Proname
"'";
}
Boolean f = false;
Try {
ST = conn.createstatement ();
f = st.execute (SQL); // Execute SQL statement
} catch (exception ex) {
EX.PrintStackTrace ();
} Finally {
Try {
IF (st! = null) {
St.close ();
}
IF (conn! = null) {
CONN.CLOSE ();
}
Dbconn.closeconn ();
} catch (sqlexception ex) {
System.out.print ("Close Connection Error");
}
Return F; // Returns the execution
}
(Table 2)
Next, we will introduce the implementation of the first page of the display, mainly from the database from the database through PlanManager.java, then passed to the JSP page via HashTable (hash table) Vector variable (jindubiao.jsp), jindubiao.jsp The data until the data is removed, and the array is placed in order.
(Table 3) Call the PlanManager to get the data
Some code in jindubiao.jsp