When trying to upload multiple files with Struts2 using ArrayList
, how to identify each field?
For example, if I have two file fields, File1
a
Name each field with different names and create corresponding accessors to action properties. Then each of them will handle the name by OGNL and set corresponding properties. Try with different approach create list or map for the files indexed by iterator tag.
in action
private List fileUpload = new ArrayList();
also accessors should be for each property
then you will know which of them uploaded by checking the file at the list index. You could also try with the Map
.
in action
private Map fileUpload = new HashMap();
what is better suits your needs