You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Troy <tr...@netscape.net> on 2001/09/03 18:59:59 UTC

doubly nested data structures and iterate

Is there a convenient way to work with the iterate tag, using the "indexed" attribute, and data structures that are doubly nested?

I have a search form with a dynamic set of search attributes, and each search attribute optionally has a dynamic set of conditions. 

I have used scriptlets to generate request parameter names in the following form: "searchAttr[i].condition[j].someProperty". And these parameters have worked with standard html tags (they've successfully updated the correct property when the from has been submitted). However, the struts taglibs don't seem to want to work. When I try to use these generated names, I get exceptions (like "Invalid declaration" exceptions, where the array subscripts on searchAttr were complained about).

Has any else worked with the iterate tag using the "indexed" attribute to accomplish something similar?

I would envision being able to do something like the following:

<logic:iterate id="searchAttr" name="searchForm" property="searchAttributes">
  <logic:iterate indexed="true" id="condition" name="searchAttr" properties="conditions">
    <html:text indexed="true" name="condition" property="someProperty" />
  </logic:iterate>
</logic:iterate>

I would then expect the <html:text> tag to generate a parameter name as my scriptlet does...

Any thoughts on this would be appreciated!

Thanks,

Troy


__________________________________________________________________
Your favorite stores, helpful shopping tools and great gift ideas. Experience the convenience of buying online with Shop@Netscape! http://shopnow.netscape.com/

Get your own FREE, personal Netscape Mail account today at http://webmail.netscape.com/


Re: doubly nested data structures and iterate

Posted by Troy Hart <th...@part.net>.
Has anyone ever used a collection within a collection???

On Monday 03 September 2001 10:59 am, Troy wrote:
> Is there a convenient way to work with the iterate tag, using the "indexed"
> attribute, and data structures that are doubly nested?
>
> I have a search form with a dynamic set of search attributes, and each
> search attribute optionally has a dynamic set of conditions.
>
> I have used scriptlets to generate request parameter names in the following
> form: "searchAttr[i].condition[j].someProperty". And these parameters have
> worked with standard html tags (they've successfully updated the correct
> property when the from has been submitted). However, the struts taglibs
> don't seem to want to work. When I try to use these generated names, I get
> exceptions (like "Invalid declaration" exceptions, where the array
> subscripts on searchAttr were complained about).
>
> Has any else worked with the iterate tag using the "indexed" attribute to
> accomplish something similar?
>
> I would envision being able to do something like the following:
>
> <logic:iterate id="searchAttr" name="searchForm"
> property="searchAttributes"> <logic:iterate indexed="true" id="condition"
> name="searchAttr" properties="conditions"> <html:text indexed="true"
> name="condition" property="someProperty" /> </logic:iterate>
> </logic:iterate>
>
> I would then expect the <html:text> tag to generate a parameter name as my
> scriptlet does...
>
> Any thoughts on this would be appreciated!
>
> Thanks,
>
> Troy
>
>
> __________________________________________________________________
> Your favorite stores, helpful shopping tools and great gift ideas.
> Experience the convenience of buying online with Shop@Netscape!
> http://shopnow.netscape.com/
>
> Get your own FREE, personal Netscape Mail account today at
> http://webmail.netscape.com/