• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Uploading Multiple Files Using html:file

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Tomorrow is the first day of the new metric calendar. Comfort me tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic