The solution, we later adopted was have a class extending ArrayList, some thing like this..
class MyList extends ArrayList{ public Object set(int index, Object element) { if(index > size()) { add(new Object()); // Add objects of appropriate type to avoid ClassCast exception } return super.set(index, element); } public Object get(int index) { if(index > size()) { add(new Object()); // Add objects of appropriate type to avoid ClassCast exception } return super.get(index); } } obviously this is simplified form of that class. Thanks and Regards, Nitish Kumar -----Original Message----- From: Niall Pemberton [mailto:[EMAIL PROTECTED] Sent: Monday, May 23, 2005 7:27 PM To: Struts Users Mailing List Subject: Re: Populating growing List The reason this isn't working lies in how Commons BeanUtils works. What you read in the wiki works for setting the properties of nested "indexed beans"- not straight forward indexed properties. In this circumstance it will just call the indexed setter so for it to work you need your lazy code there, rather than the indexed getter. Niall ----- Original Message ----- Sent: Monday, May 23, 2005 12:50 PM Subject: Populating growing List > Hi all, > > I know that common issue with indexed properties as mentioned in the wiki > http://wiki.apache.org/struts/StrutsCatalogLazyList. > > So I wrote a little handcranked lazy list but I still get an > indexoutofbounce exception. I really don't know whats going on here: > > private ArrayList deleteSelection = new ArrayList(); > > public void setDeleteSelection(int i, String toDelete) { > this.deleteSelection.set(i, toDelete); > } > > public String getDeleteSelection(int i) { > while(i>=this.deleteSelection.size()) { > this.deleteSelection.add(new String("")); > } > return (String) this.deleteSelection.get(i); > > } > > The nested exception looks like this: > > Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 > at java.util.ArrayList.RangeCheck(ArrayList.java:508) > at java.util.ArrayList.set(ArrayList.java:336) > at > com.candor.hummingbird.forms.AccountForm.setDeleteSelection(AccountForm.java > :74) --------------------------------------------------------------------- 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]