Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting multiple values from multiple Html:selects with same name.

Status
Not open for further replies.

cooljockey

Programmer
Jan 13, 2002
4
0
0
IN
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" >
<html:eek:ptions collection="alAllApps" property="value" labelProperty="label"/>
</html:select>
<html:select name="SSOLoginForm" property="strTest" multiple="true" size="4" >
<html:eek:ptions collection="alAllApps" property="value" labelProperty="label"/>
</html:select>
</html:form>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top