struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniel Massie" <daniel.mas...@jario.com>
Subject Problem using DynaValidatorForm and html:select
Date Wed, 30 Jul 2003 12:51:31 GMT
In my form I have a html:select field with multiple="true" as shown below:

<html:select multiple="true" property="property1">
	<logic:iterate collection="<%=myTypes%>" id="type" type="java.lang.String">
		<html:option value="<%=type%>"/>
			<bean:write name="type"/>
		</html:option>
	</logic:iterate>
</html:select>

where myTypes is String[]. In my struts-config file I am using
DynaValidatorForms for the form beans. The form bean for the above is:

<form-bean name="myForm"
type="org.apache.struts.validator.DynaValidatorForm">
      <form-property name="property1" type="java.lang.String" />
</form-bean>

In my Action class for this form I have tried to retrieve the values with:

String prop1 = (String) form.get("property1");

but this only returns the first element of the multiple select. I've also
tried to use ArrayLists for the above casting,and also as the type for the
form-property. When used for the casting I get a class cast exception. When
used for the form-property I get informed that its an icompatible type as
the select is returning a string.

Does anyone know how to solve this problem?

Thanks

Daniel Massie


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Mime
View raw message