The property attribute of the <html:select> must allow for capturing multiple items.  
It should be a collection.  Take a peek at html-select.jsp that is part of the 
struts-exercise-taglib application that ships with Struts.


<html:select property="foo"  size="4" multiple="true" >
        <html:options collection="managerList" property="person_id" 
labelProperty="person.name" /> </html:select>

Form bean --
  private String[] foo;
  public void setFoo(String[] in) { foo = in; }
  public String[] getFoo() { return foo; }

Sri

-----Original Message-----
From: Madel,Kurt [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, October 03, 2002 2:14 PM
To: '[EMAIL PROTECTED]'
Subject: Multiple selected for html:select


I have two collections, 1 is of managers that need to be preselected and the other is 
managers that can be selected from.  Here is my jsp code:

<html:select property="managers[0].id"  size="4" multiple="true" >
        <html:options collection="managerList" property="person_id" 
labelProperty="person.name" /> </html:select>

'managers' is a Vector in a DynaActionForm, and managerList is of type List, not sure 
if this matter. However, this works, but obviously only creates 1 selected option, as 
seen below: 

<select name="managers[0].id" multiple="multiple" size="4">
        <option value="266">Gurpreet Singh</option>
        <option value="267">James Eberhardt</option>
        <option value="268">John Fairbanks</option>
        <option value="269">Kevin Stork</option>
        <option value="277">Steve Goguen</option>
        <option value="365" selected="selected">Susan Rogers</option> </select>

What I want is for multiple managers to be selected, as below: 

<select name="managers[0].id" multiple="multiple" size="4">
        <option value="266">Gurpreet Singh</option>
        <option value="267">James Eberhardt</option>
        <option value="268">John Fairbanks</option>
        <option value="269" selected="selected">>Kevin Stork</option>
        <option value="365" selected="selected">Susan Rogers</option> </select>
        
Note, the bottom two are selected.  What do I put in the <html:select> to make this 
work?

Thanks,

Kurt Madel
Programmer, CSMi
(703) 823-4300 ext. 170



--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to