struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brandon Goodin" <>
Subject FormFile question
Date Wed, 29 Jan 2003 20:02:02 GMT
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

public setFormFiles(Collection formFiles) {
	this.formFiles = ListUtils.lazyList(new ArrayList(formFiles),new


JSP Page:
<html:file name="formFiles[1]"/>

Upon submittal I get an exception like...
java.lang.IndexOutOfBoundsException: Index: 1, Size: 0

Brandon Goodin
Phase Web and Multimedia
P (406) 862-2245
F (406) 862-0354

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message