struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kevin HaleBoyes <kzbo...@yahoo.com>
Subject repeating input fields
Date Mon, 14 Oct 2002 14:53:47 GMT
I know this has been asked before but I'm unable to find anything
in the archive - probably not using the right search terms...

I'm trying to create a form that allows the user to input a list
of strings.  Kind of like a detail block (of a master-detail
relationship).

So I have

  public class LoanPurpose {
    private String id;
    private String description;
    public String getId() {return id;}
    public void   setId( String v ) { id = v; }
    public String getDescription() {return description;}
    public void   setDescription( String v ) {description = v;}
  }

and a Form bean

  public class LoansForm extends ActionForm {
    private LoansPurpose[] purposes = null;
    public LoanPurpose[] getPurposes() {return purposes;}
    public void setPurposes( LoanPurpose[] v ) {purposes = v;}
    public void reset(ActionMapping mapping,
               HttpServletRequest request) {purposes = null;}
  }


In my JSP form I have:

<html:form action="/saveLoanPurps" method="post">
<table>
<logic:iterate id="p" name="LoansForm" property="purposes">
  <tr><td>
      <html:text name="p" property="id" size="15"/>
  </td><td>
      <bean:write name="p" property="description" filter="true"/>
  </td></tr>
</logic:iterate>
</table>
<html:submit>Save</html:submit>
</html:form>


If I stuff a few values into the purposes array in the "edit"
action they properly get displayed when the form is rendered.


This is where I get lost though.  When I hit the "Save" submit
button I don't get the results I expect.  In the Save action I
print the contents of the LoansForm.purposes array and it is null,
instead of having the contents of the input fields.

What am I missing?


Any help would be most appreciated.
Thanks,
Kevin.

__________________________________________________
Do you Yahoo!?
Faith Hill - Exclusive Performances, Videos & More
http://faith.yahoo.com

--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>


Mime
View raw message