You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Mike Finn <mi...@frontiercorp.com> on 2002/03/26 22:37:23 UTC
iterate and no collection found
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"/>
</logic:iterate>
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">
...
</logic:present>
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?
TIA,
Mike