You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Marco Mistroni <mm...@waersystems.com> on 2004/04/27 13:46:50 UTC

lOGIC:iterate inside logic:iterate

Hi all,	
Sorry 4 the spam, I posted this msg with a completely
Different subject...
	I have following problem:
I have a collection of DTOs, and I have to
Display the number of fields 'dynamically'.

In my app I have two collections, one that contains
DTOs, and the other that contains the fields to display..

Problem is that I don\t know exactly how to nest the
Two....
Like

<logic:iterate id="element" name="dtos" scope="request">
   // ok so far
   <logic:iterate id="field" name="fields" scope="request">
       // here I should do  element.'field', but  I don\t know
       // if it is possible..

anyone has a 'struts tag' solution before reverting to a 'custom tag' or
java code?

Thanx in advance and regards
	marco



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


Re: lOGIC:iterate inside logic:iterate

Posted by Kumar M <ku...@netscape.net>.

mmistroni@waersystems.com wrote:

>Hi all, 
>Sorry 4 the spam, I posted this msg with a completely
>Different subject...
>    I have following problem:
>I have a collection of DTOs, and I have to
>Display the number of fields 'dynamically'.
>
>In my app I have two collections, one that contains
>DTOs, and the other that contains the fields to display..
>
>Problem is that I don\t know exactly how to nest the
>Two....
>Like
>
><logic:iterate id="element" name="dtos" scope="request">
>   // ok so far
>   <logic:iterate id="field" name="fields" scope="request">
>       // here I should do  element.'field', but  I don\t know
>       // if it is possible..
>
how about: <bean:write name="element" property="<%= field %>" /> ??

>
>anyone has a 'struts tag' solution before reverting to a 'custom tag' or
>java code?
>
>Thanx in advance and regards
>    marco
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>For additional commands, e-mail: user-help@struts.apache.org
>
>  
>


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


Re: lOGIC:iterate inside logic:iterate

Posted by Susan Bradeen <Su...@softlanding.com>.
"Marco Mistroni" <mm...@waersystems.com> wrote on 04/27/2004 07:46:50 
AM:

> Hi all, 
> Sorry 4 the spam, I posted this msg with a completely
> Different subject...
>    I have following problem:
> I have a collection of DTOs, and I have to
> Display the number of fields 'dynamically'.
> 
> In my app I have two collections, one that contains
> DTOs, and the other that contains the fields to display..
> 
> Problem is that I don\t know exactly how to nest the
> Two....
> Like
> 
> <logic:iterate id="element" name="dtos" scope="request">
>    // ok so far
>    <logic:iterate id="field" name="fields" scope="request">
>        // here I should do  element.'field', but  I don\t know
>        // if it is possible..
>

I switched to the Nested tags (based on the original Struts 1.1 tag set) 
for this kind of scenario. They are easy to implement and may save you 
some headaches. 
http://jakarta.apache.org/struts/userGuide/struts-nested.html

However in your example, IIRC your inner iterate 'name' attribute should 
reflect your outer iterate 'id' attribute. So it might be something like:

<logic:iterate id="element" name="dtos" scope="request">
    // ok so far
    <logic:iterate id="fields" name="element" scope="request">
        <bean:write name="fields" property="fieldName" />

HTH,
Susan Bradeen



 
> anyone has a 'struts tag' solution before reverting to a 'custom tag' or
> java code?
> 
> Thanx in advance and regards
>    marco
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 


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