You do it the same way as with a single select. Just populate the property associated with the html:select tag with some data and it will show as being selected in the JSP. The only difference is that for a multiple select,the property is a String array rather than just a single String, so you must populate one or more elements of the String array with data.
[ September 18, 2007: Message edited by: Erap Estrada ]
Joined: Nov 08, 2006
Well, I was wrong. To explain clearly my problem, I have 10 items on list, but only 3 of them should be selected.
If I set the values in my Form class, it will list only the 3 and not the whole. I should have 10 items with 3 selected.
Thanks in advance! [ September 18, 2007: Message edited by: Erap Estrada ]
Joined: Feb 15, 2005
For any multiple-select box there are always two separate arrays or collections: one for the list of available options and another for the list of selected options. The list of available options is referenced by the htmlptions or htmlptionsCollection tag, and the list of selected options is referenced by the html:select tag. Your list of available options should contain the list of all possible options. Your list of selected options should be a subset of the available list and should contain only those options that should show as selected when the JSP is displayed.