求解struts2多文件上传有关问题

求解struts2多文件上传问题
最近练习一个项目,用了ssh框架,其中遇到多文件上传,我使用了struts2自带的文件上传,基于拦截器实现的吧。
jsp页面部分代码

<form id="proAdd" action="" method="post" enctype="multipart/form-data">
<table width="90%">
                              <tr>
<td height="45px" width="150px">首页图片:</td>
<td><input type="file" name="upload" id="proType" data-options="required:true"/></td>
</tr>
<tr>
<td height="45px" width="150px">详细图片1:</td>
<td><input type="file" name="upload" id="proType" data-options="required:true"/></td>
</tr>
<tr>
<td height="45px" width="150px">详细图片2:</td>
<td><input type="file" name="upload" id="proType" data-options="required:true"/></td>
</tr>
<tr>
<td height="45px" width="150px">详细图片3:</td>
<td><input type="file" name="upload" id="proType" data-options="required:true"/></td>
</tr>
<tr>
<td height="45px" width="150px">详细图片4:</td>
<td><input type="file" name="upload" id="proType" data-options="required:true"/></td>
</tr>
<tr>
<td colspan="2">
<button onclick="doSub()">提交</button>
<button>重置</button>
</td>
</tr>
          </table>
</form>


struts.xml配置:

<action name="productAction" class="com.esteban.admin.action.ProductAction">
<interceptor-ref name="fileUpload">
                 <param name="allowedTypes">image/bmp,image/jpg,image/png,image/gif,image/jpeg,image/pjpeg</param>
                   <param name="maximumSize">4000000</param>
                </interceptor-ref>
                <!-- 前面那个会覆盖掉默认的   所以这里必须配置默认的   先后顺序有关 -->
                <interceptor-ref name="defaultStack"/> 
                 <param name="savePath">/upload</param>
<result name="toAdd">/WEB-INF/admin/pro/add_pro.jsp</result>
<result name="toEdit">/WEB-INF/admin/pro/edit_pro.jsp</result>
</action>


action部分

public class ProductAction {
private ProductService productService;
private List<ProductType> proTypes;
private File[] upload;
    private String[] uploadContentType;
    private String[] uploadFileName;
    private Product product;
    //接受依赖注入的属性
    private String savePath;
    
//接受依赖注入的方法
public String getSavePath() {
return ServletActionContext.getServletContext().getRealPath("/upload");
}

public void setSavePath(String savePath) {
this.savePath = savePath;
}


public void add() throws IOException{
File[] files = getUpload();
if(files!=null){
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
for (int i = 0; i < files.length; i++) {
FileInputStream fis = new FileInputStream(files[i]);
FileOutputStream fos = new FileOutputStream(getSavePath()+"\\"+sdf.format(new Date()));
byte[] buf = new byte[1024];
int len = 0;
while((len = fis.read(buf))!=-1 ){
fos.write(buf,0,len);
}
}
}

}

public void setProTypes(List<ProductType> proTypes) {
this.proTypes = proTypes;
}

public File[] getUpload() {
return upload;
}

public void setUpload(File[] upload) {
this.upload = upload;
}

public String[] getUploadContentType() {
return uploadContentType;
}

public void setUploadContentType(String[] uploadContentType) {
this.uploadContentType = uploadContentType;
}

public String[] getUploadFileName() {
return uploadFileName;
}

public void setUploadFileName(String[] uploadFileName) {
this.uploadFileName = uploadFileName;
}
....
}


结果File[]类型的 upload 一直为空,不知道咋回事,望知道的人给予指点!感激不尽。
------解决思路----------------------
doSub()方法贴出来看看呢?
------解决思路----------------------
form文件上传不能用js提交,form表单提交,后台才能收到数据流
------解决思路----------------------
 //上传文件集合   
    private List<File> file;   
用List试试,别用数组
------解决思路----------------------
ajax也可以用表单提交的 用jq的form提交插件
form.submit()这种形式
你要用无刷新提交,
还是用插件把,uploadify之前我们项目有用过
可以实现批量上传的