You could always rig your setters/getters to check the size and create a new
array and copy over to them if the size becomes full.  Say start with 10 and
increase by 10 "FormFile"s every time your JSP needs the 11th, 21st, 31st,
etc.   Who knows if you will ever actually go over 10?  It might work but it
won't look that pretty inside your setter/getter.

Regards,
David

-----Original Message-----
From: Walter do Valle [mailto:[EMAIL PROTECTED]
Sent: Monday, October 16, 2006 4:16 PM
To: Struts Users Mailing List
Subject: Re: Why this does not work?


Ok. Thank you David.

I already have tried this, and it works.
The problem is: FormFile need to be created with correct size. If I
have, for example, 3 files, I need to initialize my arquivo variable
like this: FormFile[] arquivo = new FormFile[3]. Then in JSP I use
indexes like your example.
But the number of files is undefined.
How to workaround this situation?
Can Struts to treat this?

David Friedman escreveu:
> Actually I see something else.  You are trying to upload files using an
> array of FormFiles named arquivo. However, your notation is treating them
as
> one item instead of indexed.  Like so:
>
> private FormFile[] arquivo;
>
> So you see this code in your JSP:
>
> <html:file property="arquivo" size="50"/>
>
> Is not the same as an indexed item or array which you've defined in your
> ActionForm.  It must be accessed with indexes:
>
> <html:file property="arquivo[0]" size="50"/>
> <html:file property="arquivo[1]" size="50"/>
>
> Regards,
> David
>
> -----Original Message-----
> From: Martin Gainty [mailto:[EMAIL PROTECTED]
> Sent: Monday, October 16, 2006 3:25 PM
> To: Struts Users Mailing List
> Subject: Re: Why this does not work?
>
>
> Walter-
> You need to identify an ActionForm and work up from there
> heres a link to get you started
> http://www.roseindia.net/struts/strutsfileupload.shtml
>
> your
> <html:form action="/FooAction" should point to your Action class
>
> later in struts-config.xml you need to associate FooAction with your
custom
> form
> <action path = "/FooAction" type="Yourpackage.ConcatenarForm"
>
> where you have defined both the
> FooAction Class as well as the Forms class
> package.yourpackage.ConcatenarForm class
>
> Anyone else?
> Martin --
> This e-mail communication and any attachments may contain confidential and
> privileged information for the use of the
> designated recipients named above. If you are not the intended recipient,
> you are hereby notified that you have received
> this communication in error and that any review, disclosure,
dissemination,
> distribution or copying of it or its
> contents
> ----- Original Message -----
> From: "Walter do Valle" <[EMAIL PROTECTED]>
> To: "Struts Users Mailing List" <user@struts.apache.org>
> Sent: Monday, October 16, 2006 3:01 PM
> Subject: Why this does not work?
>
>
>
>> In Struts 1.1 I used something like that to Upload multiple files
>> (undefined number of files).
>> Why does't this work anymore?
>>
>> public class ConcatenarForm extends ActionForm {
>>
>>    private FormFile[] arquivo;
>>
>>    public FormFile[] getArquivo() {
>>        return arquivo;
>>    }
>>
>>    public void setArquivo(FormFile[] arquivo) {
>>        this.arquivo = arquivo;
>>    }
>>
>> }
>>
>> <html:form action="/concatenarArquivos" enctype="multipart/form-data"
>> method="POST" onsubmit="return validateConcatenarForm(this)">
>>              <html:file property="arquivo" size="50"/>
>>              <html:file property="arquivo" size="50"/>
>>
>> </html:form>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to