日期:2014-05-17 浏览次数:20758 次
package controller;
import java.io.File;
import java.io.IOException;
import java.util.Date;
import java.text.SimpleDateFormat;
import org.apache.commons.io.FileUtils;
import org.apache.struts2.ServletActionContext;
import upload.FileUploadTools;
import com.opensymphony.xwork2.ActionSupport;
public class Register extends ActionSupport{
/**
*
*/
private FileUploadTools fileUploadTools = new FileUploadTools();
public FileUploadTools getUploadTools(){
return fileUploadTools;
}
public void setFileUploadTools(FileUploadTools fileUploadTools){
this.fileUploadTools=fileUploadTools;
}
@Override
public void validate(){
}
public String execute() throws IOException{
fileUploadTools.beginUpload();
return "register";
}
}
package upload;
import java.io.File;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.apache.commons.io.FileUtils;
import org.apache.struts2.ServletActionContext;
public class FileUploadTools {
private String username;
private File uploadFile[];
private String uploadFileFileName[];
private String uploadFileContentType[];
public String getUsername(){
return username;
}
public void setUsername(String username){
this.username=username;
}
public File[] getUploadFile(){
return uploadFile;
}
public void setUploadFile(File[] uploadFile){
this.uploadFile=uploadFile;
}
public String[] getUploadFileFileName(){
return uploadFileFileName;
}
public void setUploadFileFileName(String[] uploadFileFileName){