If I have a vector of custom objects... how can I make struts auto populate
those objects with checkboxes?
ie
class myObject{
Integer id;
checked boolean;
}
class myActionForm{
Vector myList = new Vector();
}
myList will contain mulitable myObjects.... or am I approaching this wrong?
Thanks
> If I have a vector of custom objects... how can I make struts auto populate
> those objects with checkboxes?
>
> myList will contain mulitable myObjects.... or am I approaching this wrong?
Both your form and your object need to be JavaBeans. Struts uses BeanUtils
to populate the form, and it expects to see properly named get/set methods.
Make sure you understand how checkboxes work from an HTML perspective--
unchecked checkboxes are NOT successful form elements and will not be
present in the request. If your form is in session scope, you'll need to
manually reset the checkboxes to false/off.
If all you're trying to do is get a list of IDs, a String[] will work fine.
(The boolean is implied... true if the ID is in the array, false if not.)
If you really need that object (maybe it has other properties?) then take a
look at indexed properties.
http://struts.apache.org/faqs/indexedprops.html

Signature
Wendy Smoak
Scott Phelps - 15 Jun 2005 18:28 GMT
>> If I have a vector of custom objects... how can I make struts auto
> populate
[quoted text clipped - 21 lines]
> look at indexed properties.
> http://struts.apache.org/faqs/indexedprops.html
Yea the reason I have that obeject is because it is directly related to how
castor pulls and pushes the object to the database.