I'm using WebSphere 5.1.2 and think it's Struts 1, but I'm not sure.
My problem is the following.
I have in my form a Dynamic List of a bean BeanName, with inputs type text.
My form is something like this (can't copy&paste because it's on a Virtual Machine without Internet):
public class MyForm extends ActionForm implements Serializable {
// Property
private List beanNameList = new ArrayList();
// Simple Getter
public List getBeanNameList() {
if (beanNameList == null) {
beanNameList = new ArrayList();
}
return beanNameList ;
}
// Item Getter
public BeanName getBeanNameList(int index) {
if (beanNameList == null) {
beanNameList = new ArrayList();
}
for (int i = beanNameList.size(); i <= index; i++) {
beanNameList.add(new BeanName());
}
return (BeanName)contractList.get(index);
}
// Simple Setter
public List setBeanNameList(List value) {
return beanNameList = value;
}
// Item Setter
public BeanName getBeanNameList(int index, BeanName value) {
if (beanNameList == null) {
beanNameList = new ArrayList();
}
for (int i = beanNameList.size(); i <= index; i++) {
beanNameList.add(new BeanName());
}
contractList.set(index, value);
}
}
When I submit the form, I receive an IndexOutOfBoundsException: index: 3, size: 0.
Analizing the console, I realized Struts is using ArrayList.get, and not getBeanNameList, as you may see in the image:
Any ideas?