Oh! And one other thing, the 'property' attribute of the <html:select> represents the user's selection(s). So your form-bean should set up an String[] (since you want to allow multiple selections) where these can be stored.
Sri -----Original Message----- From: Sri Sankaran Sent: Wednesday, January 08, 2003 9:06 AM To: Struts Users Mailing List Subject: RE: 'collection' dropdown trouble If you look at the docs for <html:options> and in particular for its 'collection' attribute you will note that the value of the 'collection' attribute must be a java.util.Collection of JavaBeans. Each bean in this java.util.Collection must have the properties named by the 'property' and 'labelProperty' attributes of the tag. So, working your way back from your JSP, since you have <html:select property="memPeriodFromMonths" multiple="true"> <html:options collection="memPeriodFromMonths" property="label" labelProperty="value"/> </html:select> your form-bean must have a public getMemPeriodFromMonths() method providing a java.util.Collection of JavaBeans. Each of these beans must have public methods called getLabel() and getValue(). Hope this helped. Sri -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 08, 2003 6:55 AM To: [EMAIL PROTECTED] Subject: 'collection' dropdown trouble Hi, I'm a STRUTS newbie and I've been trying to get a 'collection' dropdown to work for what must be a couple of weeks now... The code I'm using to display the dropdown in my JSP is: <html:select property="memPeriodFromMonths" multiple="true"> <html:options collection="memPeriodFromMonths" property="label" labelProperty="value"/> </html:select> Then my getter and setter methods are: public Vector getMemPeriodFromMonths() { for (int i=1; i <= 12; i++) { memPeriodFromMonths.add(getMonthName (i)); } return memPeriodFromMonths; } public void setMemPeriodFromMonths(String newMemPeriodFromMonths) { memPeriodFromMonths = newMemPeriodFromMonths; } public String getMonthName (int monthNumber) { String strReturn = ""; switch (monthNumber){ case 1: strReturn = "Jan"; break; case 2: strReturn = "Feb"; break; case 3: strReturn = "Mar"; break; case 4: strReturn = "Apr"; break; case 5: strReturn = "May"; break; case 6: strReturn = "Jun"; break; case 7: strReturn = "Jul"; break; case 8: strReturn = "Aug"; break; case 9: strReturn = "Sep"; break; case 10: strReturn = "Oct"; break; case 11: strReturn = "Nov"; break; case 12: strReturn = "Dec"; break; } return strReturn; } Can anyone tell me what I'm doing wrong? Or mail me working sample code so I can compare? Thanks, David This message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of the email by you is prohibited. -- 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]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>