You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Johann Uhrmann <jo...@xpecto.com> on 2003/03/06 10:46:31 UTC
List-backed properties
Hello all,
I am a little bit confused about an example for list-backed properties:
The documentation at
http://jakarta.apache.org/struts/userGuide/building_controller.html
contains the following example in section 4.3.2:
public FooForm extends ActionForm {
private final List values = new ArrayList();
public void setValue(int key, Object value) {
values.set(key, value);
}
public Object getValue(int key) {
return values.get(key);
}
}
As "values" is initialized as empty ArrayList, any call to values.set
causes an IndexOutOfBoundException to be thrown.
(see also:
http://java.sun.com/j2se/1.4.1/docs/api/java/util/ArrayList.html#set(int,java.lang.Object)
)
Therefore, I cannot imagine how that example could ever work.
Could someone please explain me that discrepancy?
Thanks in advance,
Hans
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org