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

Uploading Multiple Files Using html:file

 
Greenhorn
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"/>

</logic:iterate>


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.

Thanks
Vijay
 
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?

Thanks
Deepa
 
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
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic