Since you are already trying out your own Struts form, I will assume that you have successfully ran the demo application that comes with the Struts download. I will also assume that you have modelled your Struts application after the sample application, perhaps even just adding your own form and action to it.
If you haven't done these yet, please go and try to run the sample application and understand how the different pieces work together: struts-config.xml, web.xml, your ActionForm, and your Action.
If you have already done the above, then here are a few points to consider regarding the options:
In order to select multiple items in a listbox, you should include the multiple attribute in the html:select tag. You can assign this attribute any arbitrary value but you would normally use "true" for it to make sense to someone reading the codeWhen multiple values for a property can be submitted, the corresponding property in the ActionForm should be a String array. E.g. if you have // in JSP:
<html:select property="states" multiple="true">
<html:options ... />
</html:select>
// in ActionForm:
private String[] states;
public void setStates(String[] newStates) {
states = newStates;
}
public String[] getStates() {
return states;
}
Make sure your ActionForm follows the above
pattern first. It's getting late for me and I have to go but if you still have a problem, then I'll tell you about using the html:options tomorrow.
[ March 31, 2003: Message edited by: Junilu Lacar ]