jaggernat
asked on
<html:select>
Dear experts
1) I have this in my jsp
<html:select property="abc" multiple="multiple"/>
Values in this field are populated on page load which are coming from the database.
2) I have this in my form bean
<form-bean name="Form" type="org.apache.struts.va lidator.Dy naValidato rForm" dynamic="true">
<form-property name="abc" type="java.lang.String"/>
</form-bean>
My requirment: I am selecting multiple values in my above <html:select> field
and i want to store all the values in an Array / ArrayList in my action class.
any ideas how i can approach on this
thanks
J
1) I have this in my jsp
<html:select property="abc" multiple="multiple"/>
Values in this field are populated on page load which are coming from the database.
2) I have this in my form bean
<form-bean name="Form" type="org.apache.struts.va
<form-property name="abc" type="java.lang.String"/>
</form-bean>
My requirment: I am selecting multiple values in my above <html:select> field
and i want to store all the values in an Array / ArrayList in my action class.
any ideas how i can approach on this
thanks
J
You can also set it to an ArrayList
<form property name="abc" type="java.util.ArrayList" >
<form property name="abc" type="java.util.ArrayList"
ASKER
ok got it.
but how do i get the array/arraylist values in my action class?
public ActionForward getArrayValues(ActionMappi ng mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
{
DynaValidatorForm f = (DynaValidatorForm) form;
f.???? //What do i do here to get all the values which user selected in the <html:select property="selectedvalues" multiple="multiple" width="40"> ?
return mapping.findForward("succe ss");
}
any help greatly appreciated.
thanks
J
but how do i get the array/arraylist values in my action class?
public ActionForward getArrayValues(ActionMappi
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
{
DynaValidatorForm f = (DynaValidatorForm) form;
f.???? //What do i do here to get all the values which user selected in the <html:select property="selectedvalues" multiple="multiple" width="40"> ?
return mapping.findForward("succe
}
any help greatly appreciated.
thanks
J
ArrayList abc = (ArrayList)f.get("abc")
ASKER
ok thanks.
so is it possible to find out the values which user selected from this arraylist or array?
thanks
so is it possible to find out the values which user selected from this arraylist or array?
thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thanks
<form-property name="abc" type="java.lang.String[]"/