【发布时间】:2016-11-14 14:37:40
【问题描述】:
我有一个场景,我想上传多个文件,其中用户可能会或可能不会上传文件,并且我想维护用户上传文件的位置的索引,并希望将该索引保存为名称的文件
我提到了https://stackoverflow.com/a/17050230/3425489 ,在我的情况下我不想创建新类,所以没有提到接受的解决方案
直到现在在我的Action Class我有
File upload [];
String uploadContentType []
String uploadFileName []
getter 和 setter
在我的jsp中我试过了
<input type="file" name="upload">
但我只能获取上传的文件,无法维护索引
也试过
<input type="file" name="upload[0]">
<input type="file" name="upload[1]">
<input type="file" name="upload[2]">
在这种情况下,我无法在我的 Action 类中设置属性
----更新----
你可以参考我的模特 Struts 2 : Unable to access Model properties in JSP
对于您的每个 ProcessSolutionStep,我想维护,为特定步骤上传哪个文件,
即用户可以上传步骤 1 和 步骤 5 的文件,跳过中间步骤,并在视图中。
我想显示为特定步骤上传的文件
【问题讨论】:
标签: java jsp file-upload struts2 struts-action