Suppose a JSP form has, among other elements, a listbox that allows the user to make multiple selections. After the form is submitted
Created May 7, 2012
Mobushir Hingorjo Just define the setter method of the bean to accept a String[] as argument.
For example if you have multiple selections of the name "listvalue", then your setter method will look like:
For example if you have multiple selections of the name "listvalue", then your setter method will look like:
public void setListvalue(String [] listvalue) {
this.listvalue = listvalue;
}
The JSP engine will automatically create a String array of all parameters named "listvalue" and pass that array to the setter method.
The setProperty tag will work as usual. You can use either the property="*" for all parameters or property="listvalue" for just the listvalue parameter.