• 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 ...
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Uploading Multiple Files Using html:file

Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All.,

I am working with Struts and i ran into a problem while trying to upload multiple files using struts tags.

<logic:iterate ....>
<html:file property="formFile" indexed="true"/>
<html:button property="Upload" indexed="true"/>


and in formBean

private FormFile formFile=null;

public FormFile getFormFile(){
return this.formFile;

public void setFormFile(FormFile formFile){
this.formFile = formFile;

for example the generated response has 10 browse buttons for uploading files., when i upload some file in the 10th "Browse" then its accepting a for all the remaining browse(textbox) buttons., nothing is getting uploaded into server,Infact its taking null values. The main problem is that i am unable to find an accurate mapping in as formBean property for the jsp defined UI control.

Help me out.

Ranch Hand
Posts: 948
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have written a dozen or so pages that used indexed properties, but each time I have to look through the Struts documentation or use the previous code as an example. Do you really want to use an indexed property here?

If so I would expect your bean to contain an array or List of FormFile objects and that you would have methods like this:

- Brent
Ranch Hand
Posts: 68
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Brent,
Is there a need to user indexed property if I have to use form files array?
There will be multiple files uploaded that has same property name in struts form and unknown number of files to be uploaded. Is there any examples available to refer the same situation?

Sometimes you feel like a nut. Sometimes you feel like a tiny ad.
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic