帮帮忙 实现struts上传
原来的代码如下:
AActionForm.java
package com.sql.struts;
import org.apache.struts.action.ActionForm;
public class AActionForm extends ActionForm{
String id=null;
String name=null;
String password=null;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
}
DBConn.java
package com.sql.struts;
import java.sql.*;
public class DBConn{
String sDBDriver= "org.gjt.mm.mysql.Driver ";
String sConnStr= "jdbc:mysql://127.0.0.1:3306/strutsdatabase?user=root&password=123456&useUnicode=true&characterEncoding=ISO-8859-1 ";
Connection conn=null;
ResultSet rs=null;
public DBConn(){
try{
Class.forName(sDBDriver);
}
catch(
java.lang.ClassNotFoundException e){
System.out.println( "Jdbc_conn(): "+e.getMessage());
}
}
public void executeUpdate(String sql)throws Exception{
//sql=new String(sql.getBytes( "GBK "), "ISO8859_1 ");
try{
conn=DriverManager.getConnection(sConnStr);
Statement stmt=conn.createStatement();
stmt.executeUpdate(sql);
conn.close();
stmt.close();
}
catch(
SQLException ex){
System.out.println( "sql.executeUpdate: "+ex.getMessage());
}
}
public ResultSet executeQuery(String sql)throws Exception{
rs=null;