Steven, 
        here's my code snippets where I had defined my title field
property as an array of strings so that I can have a variable number of
text input fields that all have the same name.

        Getting the content displayed is not a problem but I have a
problem in updating information of each object contained in the array
list. Specifically, when I submit the form, I get nothing in the Array.
Anyone got any ideas?

here's my JSP:
================
<logic:iterate id="titleField" name="newsletterForm" property="titles">
<TR VALIGN="top">       <TD WIDTH="25%"><html:textarea
name="newsletterForm" property="titles" cols="25" rows="4"
indexed="true"/></TD></TR>
</logic:iterate>

in the NewsletterFormBean
=============================
protected String[] titles = new String [8];
public String[] getTitles() {
        return this.titles;
}

public void setTitles(String[] inTitles) {
            this.titles = inTitles;
}

in the Action class
=====================
String tempArray[] = aNewsletterForm.getTitles();
ejbBean.setContent(tempArray);


+trish


-----Original Message-----
From: Renaud Waldura [mailto:[EMAIL PROTECTED]]
Sent: Sunday, October 21, 2001 10:53 AM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: Problem populating form bean with multiple parameters of
same name


Have you tried declaring your property as an array of strings?

private String propertyName[];
public String[] getPropertyName() { ... }
public void setPropertyName(String[] propertyName) { ... }


It may just work. In general I've found Struts to be amazingly flexible
with
properties and their types. Kudos to the Struts developers!

--Renaud




----- Original Message -----
From: "Steven Valin" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, October 20, 2001 6:01 AM
Subject: Problem populating form bean with multiple parameters of same
name


> Does anybody know how Struts be made to populate an ActionForm bean
with
> a variable number of text input fields that all have the same name?
>
> For instance, there may be 0, 1, 5, 10, or any other number of
> <html:text property="propertyName" size="20"/> tags in an <html:form>.
>
> I want Struts to populate the ActionForm bean with all of the
> "propertyName" values, either one at a time via multiple calls to the
> ActionForm's setPropertyName(String propertyName) method, or all at
once
> in an array (or other data structure) much like would be accomplished
> with the ServletRequest.getParameterValues("propertyName") method.
>
> I have tried to accomplish this any number of ways but have been
> unsuccessful and haven't seen anything in the documentation explaining
> how this should be done.
>
> TIA, Steve
>
> --
> Steven Valin
> [EMAIL PROTECTED]
>
>
>

Reply via email to