Hello,
I am new to web development and this is my first
struts application. I am developing a feature in a large application that allows for custom reporting. I am having a problem with uploading multiple files using separate "Upload" buttons. Basically, the input to generate reports can either be manually entered or the user may select to upload a comma separated file. However, the inputs are come from different textareas that are populated by the uploaded files from 3 different selections. I am using FormFile to upload the files and it works great for the first file and the textarea is populated corrected. But when when I try to upload the next file, the Action class is not able to obtain the file location. I noticed in debug mode that the all the file attributes are either empty ("") or null.
Here's what I have defined in my
JSP:
(btw - I have tried using <html:file> and I am getting the same results)
Here's what I have configured in the struts.xml file:
Here is what I have in my ActionForm:
My Action class is fairly large so I'll just add the code that handles the file upload:
There is something that maybe a clue as to why this is not working, however, I was not able to find any reference on this anywhere. I noticed that during debug that the file object contains an attribute: FieldName. FieldName contains the value: "theFile". Notice that the property name for the first tag in my file is "theFile". It seems to me - and I'm just guessing here - that struts only allows for a single file upload in a session. Is there something I need to do that allows for what I am trying to do? I would appreciate any help in this matter or some pointers that would some an example for how this can be done.
Thanks,
Jerome