struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "alexj" <al...@freesurf.ch>
Subject Re: FormFile question
Date Wed, 29 Jan 2003 20:08:34 GMT
you never add element into your collection and you try to access an
indefined index .

----- Original Message -----
From: "Brandon Goodin" <mail@phase.ws>
To: "Struts User List" <struts-user@jakarta.apache.org>
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
> mail@phase.ws
> http://www.phase.ws
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Mime
View raw message