我使用Struts标签提交多行数据,其中有多个上传文件。
代码:
<form enctype="multipart/form-data">    
<html:text  property="shoppingCount"/>
<html:text property="ab"/>
...
<html:text property="ad"/>
<html:file property="file"/>"
<html:file property="file1"/>
...    
</form>    
原来actionform 如下:
public class MapForm extends ActionForm
{
private Map map = null;
public void setMap(Map map) {
this.map = map;
}
public Map getMap() {
return this.map;
}
现在增加了这几个文件上传标签,actionform、action该如何处理?

解决方案 »

  1.   


    import org.apache.struts.action.ActionForm;
    import org.apache.struts.upload.FormFile;public class FileForm extends ActionForm {
        private FormFile file = null; public FormFile getFile() {
    return file;
    } public void setFile(FormFile file) {
    this.file = file;
    }
    }
    Action中得到Form中FormFile 对象 然后调用其相应的方法就行了
      

  2.   


    跟我想的一样,从from中做文章。。