You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Raible, Matt" <Ma...@cable.comcast.com> on 2003/01/16 22:31:08 UTC
Indexed Properties and Population
I have an ArrayList on a form... let's call the form Parent and the
ArrayList Children.
If I have:
private ArrayList children;
public void setChildren(int index, ChildForm childForm) {
this.children.set(index, childForm);
}
Then saving my form results in a NPE for BeanUtils.copyProperties. If I
create a whole bunch of objects in the ArrayList in the constructor - I
avoid this problem:
public ParentForm () {
children = new ArrayList(100);
for (int i=0; i < 100; i++) {
children.add(new ChildForm());
}
But I'm guessing that this fits better into the reset(mapping, request)
method of my form. My question is - how do I determine how many there are?
Is there something in the request this this information - or should I set a
hidden field with the number of children?
Thanks,
Matt
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
RE: Indexed Properties and Population
Posted by Mark Galbreath <ma...@qat.com>.
int elements = children.size()
?
Where are you defining this method?
-----Original Message-----
From: Raible, Matt [mailto:Matt_Raible@cable.comcast.com]
Sent: Thursday, January 16, 2003 4:31 PM
If I have:
private ArrayList children;
public void setChildren(int index, ChildForm childForm) {
this.children.set(index, childForm);
}
My question is - how do I determine how many there are? Is there something
in the request this this information - or should I set a hidden field with
the number of children?
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>