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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to