Also, after reviewing the code. Why does the CommonsMultipartRequestHandler
have the CommonsFormFile as an inner class. I imagine the CommonsFormFile is
what I need to get at. It would be nice if it weren't an inner class. Why an
inner class?

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


-----Original Message-----
From: Brandon Goodin [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 29, 2003 1:02 PM
To: Struts User List
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]

Reply via email to