Yes.  In fact, since I just tested it again, it won't even work with
non-multiple... I have hosed something.  Wah.

Here: (I used to have just String[] get/setters but Tomcat whined about
reflection, so I did this:)

(JSP)

<html:select property="ids" multiple="true">
<html:options property="ids"/>
</html:select>

(class)

public class AttendanceForm extends org.apache.struts.action.ActionForm {

    private String date = "";
    private String[] ids = {"0","1"};
    private String[] names = {"Zero","One"};

    public AttendanceForm() {
        java.util.Calendar cal = java.util.GregorianCalendar.getInstance();
        while (cal.get(java.util.Calendar.DAY_OF_WEEK) !=
java.util.Calendar.SUNDAY) {
            cal.add(java.util.Calendar.DAY_OF_MONTH, -1);
        }
        java.text.SimpleDateFormat df = new
java.text.SimpleDateFormat("MM/dd/yy");
        this.date = df.format(cal.getTime());
    }

    public void setIds (java.util.ArrayList ids) {
        this.ids = (String[])ids.toArray();
    }

    public String[] getIds () {
        return this.ids;
    }

    public void setIds (int i, String id) {
        this.ids[i] = id;
    }

    public String getIds (int i) {
        return this.ids[i];
    }

    public void setDate(String date) {
        this.date = date;
    }

...


?
----- Original Message -----
From: "David Graham" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, February 23, 2003 9:41 PM
Subject: Re: <html:select> "multiple" problems


> Does your form class have
>
> public String[] getMyArray()...
> public void setMyArray(String[] a)...
>
> and does your jsp have
>
> <html:select property="myArray" multiple="true"> ?
>
> David
>
>
> >AAAARGGGGGH!!!!
> >
> >I would give one of my legs right now for a working example of an
> ><html:select multiple="true"> usage that populates an array in an
> >ActionForm.
> >
> >Help?
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: [EMAIL PROTECTED]
> >For additional commands, e-mail: [EMAIL PROTECTED]
>
>
> _________________________________________________________________
> Tired of spam? Get advanced junk mail protection with MSN 8.
> http://join.msn.com/?page=features/junkmail
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


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

Reply via email to