写成多个filefrom,多次提交,好象不支持数组

解决方案 »

  1.   

    我的FILE控件个数不是固定的。高手啊。。
      

  2.   

    get方法改成下面这个试试看:
    public FormFile[] getNewFileList() {
            return this.newFileList;
    }
      

  3.   

    用数组是可以的……,这个属性也许会对你有用。Indexed="true"
      

  4.   

    JSP:
    <logic:iterate id="myBean1" name="myBean" property="files" indexId="index" scope="session">
    <td width="50%">
    <html:file property='<%="newFileList[" + (java.lang.Integer) pageContext.findAttribute("index") + "]"%>' size="30"></html:file>
    </td>
    </logic:iterate>
    ACTIONFORM:
        private FormFile[] newFileList;
        
        public void setNewFileList(FormFile[] newFileList) {
            this.newFileList = newFileList;
        }
        
        public FormFile getNewFileList(int i) {
            return this.newFileList[i];
        }
    thanks all!!!
      

  5.   

    前端一定要用logic:iterate作循环吗?如果有多个
    <html:file property="imagefile" />
    <html:file property="imagefile" />
    而且这些表单是通过javascript动态创建的,个数不定,怎么办呢
      

  6.   

    没有是试过使用javascript动态创建,但是我在调试过程中,多个表单使用同一个属性名没有成功。错误总是出在struts的数据绑定上。估计动态生成的表单属性名一定要和ACTIONFORM中的数组名一样(包括下标),既
    <html:file property="imagefile[1]" />要对应ACTIONFORM中的imagefile[1]。
    这样生成的控件在JAVASCRIPT中不好控制。
    如果找出好的解决办法希望能通知一声。[email protected],谢了。