struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mike Finn" <>
Subject iterate and no collection found
Date Tue, 26 Mar 2002 21:37:23 GMT
Hi All,

I have a form with an array of subforms on it, like so:

class BigForm extends ActionForm
  SubForm subFormX[];

  public SubForm[] getSubFormX() { return subFormX; }
  public void setSubFormX(SubForm[] newSubFormX) { this.subFormX =
newSubFormX; }
 // ....other attributes...

When this has no data in it, and I use iterator on it, like so:
(assume "TheBigForm" is declared w/ type BigForm in struts-config.xml)

<logic:iterate name="TheBigForm" property="subFormX" id="subForm">
   <bean:write property="subFormPropOne" name="subForm"/>

I get "No Collection found" ServletException.  The BigForm is in request
scope, and in fact if I force-feed it with data, everything works OK. I also
wrapped the iterate block with logic:present to no avail:
<logic:present name="TheBigForm" property="subFormX">

Also, I initialized the array to new SubFormX[0] - again, no luck.

What is the correct way to handle this situation - where you have a sub or
child form with an empty array?


View raw message