I have a context-scoped LabelValueBean called "selectcharistics" that drives the display of a multibox element on a
jsp page. The jsp page snippet is below:
<c:foreach var="chars" items="${selectcharistics}">
<html:multibox property="charistics">${chars.value}</html:multibox>${chars.label}
</c:foreach> Whenever the form is submitted I get and handle the array of strings (containing the ${chars.value}) that are selected. However, I don't know how to properly handle the multibox element in my DynaValidatorForm so that if the form fails the validation, the resulting error screen populates the checkboxes previously selected.
My struts-config.xml looks something like this:
<form-bean name="insert" type="org.apache.struts.validator.DynaValidatorForm">
<form-property name = "name" type="java.lang.String"/>
<form-property name = "charistics" type="java.lang.String"/>
</form-bean> Since charistics is really an array of Strings, is the type correct? Seems to me it should be set to Array, but that errors out as well. How can I configure the <form-bean> element properly so that the multibox elements that were checked prior to the form being submitted are checked in the resulting error screen? Here is a snippet of my jsp error screen (it currently errors out when validation fails):
<c:foreach var="chars" items="${selectcharistics}">
<html:multibox property="charistics"/>
</c:foreach> If anyone can shed some light on this for me (or provide some good references with an example of this type of functionality), I would appreciate it!
Thanks,
Scott