struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From maestro <>
Subject Re: How to get dynamic number of arguments into ActionForm
Date Mon, 05 May 2008 15:05:27 GMT
I accomplished this without using the DynaActionForm.
Its somewhat a crude way but it works.
When stuck with constraints what is one to do?

Here is an example, in the JSP I have coded the form element:
<input id="firstName<c:out value='${bnfIndex}'/>" type="text"
name="beneficiaries[<c:out value='${bnfIndex}'/>].firstName" value="<c:out
value='${beneficiary.firstName}'/>" size="15" maxlength="24">

Once rendered in the HTML:
<input id="firstName0" type="text" name="beneficiaries[0].firstName"
value="Joe" size="15" maxlength="24">

In the form bean:

private List beneficiaries = new ArrayList();

public BeneficiaryVO getBeneficiaries(int index) {
   while (index >= beneficiaries.size()) {
      beneficiaries.add(new BeneficiaryVO());

   return (BeneficiaryVO) beneficiaries.get(index);


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message