I think my solution is much simpler. Instead of trying to place the FormFile
directly into the colleciton I need to create a bean that will wrap the
FormFile and hold the value as a property (setter/getter). I'll try that and
post my findings. I have never used a property name that ended with an index
number. Perhaps this is not a proper use.

Brandon Goodin
Phase Web and Multimedia
P (406) 862-2245
F (406) 862-0354
[EMAIL PROTECTED]
http://www.phase.ws


-----Original Message-----
From: alexj [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 29, 2003 1:09 PM
To: Struts Users Mailing List
Subject: Re: FormFile question


you never add element into your collection and you try to access an
indefined index .

----- Original Message -----
From: "Brandon Goodin" <[EMAIL PROTECTED]>
To: "Struts User List" <[EMAIL PROTECTED]>
Sent: Wednesday, January 29, 2003 9:02 PM
Subject: FormFile question


> I have a page that uploads multiple files. I want to place these files
into
> a Collection. I keep getting an IndexOutOfBoundException. I have used the
> lazyList extensively to fill other collections without issue. This is the
> first time I have tried to use if for a file upload.
>
> Just for observation you may notice, in the code example, I do not have a
> formFiles[0] index. The lazyList normally cures this because the Array is
> prepopulated with Objects which are specified as the second parameter of
> lazyList method.
>
> I believe the problem to be that I am not populating the lazyList with the
> right Objects. The problem that I am facing is finding out what kind of
> Object uploaded files are translated to. I know about the FormFile.. but
it
> is an interface and (obviously) can't instantiate that. So what object do
I
> need to prepopulate my lazyList with to allow the uploaded files objects
to
> be put into a collections?
>
> For example:
>
> JAVA Code:
>
> public class MyClass{
>
> Collection formFiles;
>
> public MyClass() {
> this.formFiles = ListUtils.lazyList(new ArrayList(),new
> java.lang.Object());
> }
>
> public setFormFiles(Collection formFiles) {
> this.formFiles = ListUtils.lazyList(new ArrayList(formFiles),new
> java.lang.Object());
> }
>
> }
>
> ...
> JSP Page:
> <html:file name="formFiles[1]"/>
>
> Upon submittal I get an exception like...
> java.lang.IndexOutOfBoundsException: Index: 1, Size: 0
>
> Thanks,
> Brandon Goodin
> Phase Web and Multimedia
> P (406) 862-2245
> F (406) 862-0354
> [EMAIL PROTECTED]
> http://www.phase.ws
>
>
>
> ---------------------------------------------------------------------
> 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