Due to the convenient and fast database characteristics of JavaBeans, see another article. Make us convenient to record the database to add editing and deletion modifications. The preparation of this feature can be completely automated, that is, design a database, for this database The JSP code for the new editing delete function can be automatically prepared. It is now analyzed as follows:
1. Create a database xxx:
Need to guarantee a primary key
Create Table XXX (ID INT (20) Not Null Auto_Increment, record name record name 2 ........ primary key (id))
2. Established bean assumptions to xxx.java
// SET Data Sheet Record Name // Get Data Sheet Record Name // This is the predetermined write method of bean, visible to my article data bean automatic assignment private int ID = 0; public void setid (int ID) {this.id = ID;} public int getId () {return;} private string record name = 0; public void set record name (String record name) {this. Record name = record name;} public string get record name () {Return Record Name;} .... // Recommended with Replace instead of INSERT and UPDATE I / / Implement the database XXX in the Replace method // such as Replace INTP XXX (ID, record name, ..) VALUES (?,? , ..) PUBLIC VOID Replace () throws Exception {.....} public void delete () throws exception {.....} public void selete () throws exception {.....}
3. Join the process control in XXX.JSP: