• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • paul wheaton
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Tim Holloway
  • Carey Brown
  • salvin francis

Upload multiple files with separate submit buttons

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Jerome Jabson
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry Everyone,

I figured out the problem! My mistake in the Action class.

Sorry for the any inconvenience.

Jerome
 
I'm a lumberjack and I'm okay, I sleep all night and work all day. Lumberjack ad:
create, convert, edit or print DOC and DOCX in Java
https://products.aspose.com/words/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!