On 9 Jan 2004, at 21:46, Wendy Smoak wrote:
I have a String[] property in a DynaValidatorForm. It works fine with multiple checkboxes and accepts multiple selections.
Now I need to do an "advanced" user interface, where the user can enter
the information in text boxes and click 'Add'. Behind the scenes I need
to populate that String[] property (which is named 'accounts').
I don't want to deal with checking the size of the array and the inevitable out of bounds exceptions, so I thought ArrayList would be a better choice. However, when I change to ArrayList, including struts-config.xml:
<form-property name="accounts" type="java.util.ArrayList"/>
BeanUtils complains when I submit the form that has the multiple checkboxes:
org.apache.commons.beanutils.ConversionException: Cannot assign value of type 'java.lang.String' to property 'accounts' of type 'java.util.ArrayList'
The docs indicate that ArrayList is allowed in DynaActionForms (mine is
a DynaValidatorForm):
http://jakarta.apache.org/struts/userGuide/ building_controller.html#dyna
_action_form_classes
The multibox tag is: <c:forEach items="${accountMap[accountForm.map.calendarYear]}" var="account" > <html-el:multibox property="accounts"> <c:out value="${account.key}"/> </html-el:multibox> <c:out value="${account.key}"/> <c:out value="${account.costCenterDesc}"/> <br/> </c:forEach>
Which correctly renders checkboxes such as <input type="checkbox" name="accounts" value="55_U_ABCD1234">55_U_ABCD1234 Some Account<br/> <input type="checkbox" name="accounts" value="66_S_EFGH5678">66_S_EFGH5678 Some Other Account<br/>
Any idea what I'm doing wrong, or is there a better way to do this?
-- Wendy Smoak Application Systems Analyst, Sr. ASU IA Information Resources Management
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]