cooljockey
Programmer
Hi, I need to have multiple html:selects on my JSP page with same name. How can i retrive value from these multiple selects.
I'm able to get multiple values from singel select box by defining <form-property name="strTest" type="java.lang.String[]" /> in struts config file.
But not able to figure out how to get multiple values from multiple selects with same names
Attaching my sample code below:
Form bean definaion in struts-config.xml file
----------------------------------------------
<form-beans>
<form-bean name="SSOLoginForm" type="org.apache.struts.action.DynaActionForm">
<form-property name="actionFlag" type="java.lang.String"/>
<form-property name="ssoId" type="java.lang.String"/>
<form-property name="strTest" type="java.lang.String[]" />
</form-bean>
</form-beans>
JSP page code
----------------------------------------------
<jsp:useBean id="alAllApps" class="java.util.ArrayList" scope="request"/>
<html:form name="SSOLoginForm" type="org.apache.struts.action.DynaActionForm" action="/ssoAction">
<html:select name="SSOLoginForm" property="strTest" multiple="true" size="4" >
<htmlptions collection="alAllApps" property="value" labelProperty="label"/>
</html:select>
<html:select name="SSOLoginForm" property="strTest" multiple="true" size="4" >
<htmlptions collection="alAllApps" property="value" labelProperty="label"/>
</html:select>
</html:form>
I'm able to get multiple values from singel select box by defining <form-property name="strTest" type="java.lang.String[]" /> in struts config file.
But not able to figure out how to get multiple values from multiple selects with same names
Attaching my sample code below:
Form bean definaion in struts-config.xml file
----------------------------------------------
<form-beans>
<form-bean name="SSOLoginForm" type="org.apache.struts.action.DynaActionForm">
<form-property name="actionFlag" type="java.lang.String"/>
<form-property name="ssoId" type="java.lang.String"/>
<form-property name="strTest" type="java.lang.String[]" />
</form-bean>
</form-beans>
JSP page code
----------------------------------------------
<jsp:useBean id="alAllApps" class="java.util.ArrayList" scope="request"/>
<html:form name="SSOLoginForm" type="org.apache.struts.action.DynaActionForm" action="/ssoAction">
<html:select name="SSOLoginForm" property="strTest" multiple="true" size="4" >
<htmlptions collection="alAllApps" property="value" labelProperty="label"/>
</html:select>
<html:select name="SSOLoginForm" property="strTest" multiple="true" size="4" >
<htmlptions collection="alAllApps" property="value" labelProperty="label"/>
</html:select>
</html:form>