You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Alexandre Sorokine <so...@vtt.co.jp> on 2002/10/10 04:29:55 UTC

inside : is this possible?

Hi All!

I am writing an application where user will be presented with a form 
that has several "File Select" fields.  The list of input fields is 
generated using <logic:iterate>.  It works fine for all input field 
types except for "File Select".  In that case I am getting "Argument 
type mismatch" error on submit.  Does anybody have an idea of what can 
be wrong or if it is possible to have an array of "File Select" fields 
in Struts? (I am using Struts 1.1 b2 on Tomcat 4.0)

-- 
Alexandre Sorokine
Department of Geography
University at Buffalo
mailto:sorokine@buffalo.edu


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: inside : is this possible?

Posted by Alexandre Sorokine <so...@vtt.co.jp>.
Andrew,

Andrew Hill wrote:
> Afaik , you cant have indexed file fields (I hope Im wrong and someone
> corrects me on this!)
> ie: setFoo(FormFile[] files)
> Least it didnt work when I tried experimenting with it. (Same error as you
> got)

It does not seem that this behavior is documented.  This page 
http://jakarta.apache.org/struts/struts-html.html#file lists "indexed" 
as a valid attribute for the <html:file...> tag.  So I asumed that it 
should be supported.

> If each of those file fields has its own unique setter then it will be ok -
> of course that means you need to know how many files you have at compile
> time (or at least the maximum) so you can create individual setters on the
> ActionForm for each.
> setFoo1(FormFile ff)
> setFoo2(For...
> setFoo3(F...
> setFoo64(FormFil...
> setFoo1693(Fo...
> setFoo32767(Fo..
> setFoo16777216(F... (maybe I exagerate a little, but you get the picture
> ;->)
> :-(

I've also thought of this.  It is ugly but it's not that impractical as 
it may seem at the first glance.  Clicking "Browse..." button and 
selecting a file for more than a dozen times does not sound like fun. 
So if I do not find a "good" solution, I will allow a user to specify up 
to about 20 files using indvidual setters.  If he or she has more files 
I will make an option to upload them like a single zip file and then 
uncompress it on the server.

> I ended up doing my page in a different way (that involved uploading one
> file at at time hotmail style), but the PTB dont like that so Ill also be
> quite interested to see what other responses your question gets!

I will e-mail you if I have any solutions in sight.

> -----Original Message-----
> From: Alexandre Sorokine [mailto:sorokin@vtt.co.jp]
> Sent: Thursday, October 10, 2002 10:30
> To: struts-user@jakarta.apache.org
> Subject: <html:file> inside <logic:iterate>: is this possible?
> 
> 
> Hi All!
> 
> I am writing an application where user will be presented with a form
> that has several "File Select" fields.  The list of input fields is
> generated using <logic:iterate>.  It works fine for all input field
> types except for "File Select".  In that case I am getting "Argument
> type mismatch" error on submit.  Does anybody have an idea of what can
> be wrong or if it is possible to have an array of "File Select" fields
> in Struts? (I am using Struts 1.1 b2 on Tomcat 4.0)
> 
> --
> Alexandre Sorokine
> Department of Geography
> University at Buffalo
> mailto:sorokine@buffalo.edu
> 
> 
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
> 
> 



-- 
Alexandre Sorokine
Department of Geography
University at Buffalo
mailto:sorokine@buffalo.edu


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: inside : is this possible?

Posted by Andrew Hill <an...@gridnode.com>.
Afaik , you cant have indexed file fields (I hope Im wrong and someone
corrects me on this!)
ie: setFoo(FormFile[] files)
Least it didnt work when I tried experimenting with it. (Same error as you
got)
If each of those file fields has its own unique setter then it will be ok -
of course that means you need to know how many files you have at compile
time (or at least the maximum) so you can create individual setters on the
ActionForm for each.
setFoo1(FormFile ff)
setFoo2(For...
setFoo3(F...
setFoo64(FormFil...
setFoo1693(Fo...
setFoo32767(Fo..
setFoo16777216(F... (maybe I exagerate a little, but you get the picture
;->)
:-(
I ended up doing my page in a different way (that involved uploading one
file at at time hotmail style), but the PTB dont like that so Ill also be
quite interested to see what other responses your question gets!

-----Original Message-----
From: Alexandre Sorokine [mailto:sorokin@vtt.co.jp]
Sent: Thursday, October 10, 2002 10:30
To: struts-user@jakarta.apache.org
Subject: <html:file> inside <logic:iterate>: is this possible?


Hi All!

I am writing an application where user will be presented with a form
that has several "File Select" fields.  The list of input fields is
generated using <logic:iterate>.  It works fine for all input field
types except for "File Select".  In that case I am getting "Argument
type mismatch" error on submit.  Does anybody have an idea of what can
be wrong or if it is possible to have an array of "File Select" fields
in Struts? (I am using Struts 1.1 b2 on Tomcat 4.0)

--
Alexandre Sorokine
Department of Geography
University at Buffalo
mailto:sorokine@buffalo.edu


--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>