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]>

Reply via email to