You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by hemant <xr...@yahoo.com> on 2002/03/21 18:10:30 UTC

>- Iterate tag with multiple id's? -<

Here is a scenario. (Struts 1.0.2.)

I get a collection of objects and each object holds references to 2 more objects, which are essentially beans. I want to iterate, and get data from both these beans at once but the iterate tag allows only "one bean id declaration" per "iterate" as shown below (unless Iam  wrong and should be thrown into hell for such an assumption)

<logic:iterate collection="ldmbean" id="crapValueObj">
//....
</logic:iterate>

I wish there was a way to say 

<logic:iterate collection="ldmbean" id="crapValueObj", "moreCrapValueObj">
// get data from both crapValueObj and moreCrapValueObj
</logic:iterate>




Thanks 4 your time
hemant


Re: >- Iterate tag with multiple id's? -<

Posted by Arron Bates <ar...@pacific.net.au>.
You could just the bean properties from the returned object.
Say each one had a "name" attribute, to write it out...

<logic:iterate id="iterateBean" ....>
    <bean:write name="iterateBean" property="beanPropertyOne.name" />
    <bean:write name="iterateBean" property="beanPropertyTwo.name" />
</logic:iterate>

Nested tags version...
<nested:iterate property="myCollection>
    <nested:write property="beanPropertyOne.name" />
    <nested:write property="beanPropertyTwo.name" />
</nested:iterate>

Either one will do what you're after.

Arron.

hemant wrote:

>Here is a scenario. (Struts 1.0.2.)
>
>I get a collection of objects and each object holds references to 2 more objects, which are essentially beans. I want to iterate, and get data from both these beans at once but the iterate tag allows only "one bean id declaration" per "iterate" as shown below (unless Iam  wrong and should be thrown into hell for such an assumption)
>
><logic:iterate collection="ldmbean" id="crapValueObj">
>//....
></logic:iterate>
>
>I wish there was a way to say 
>
><logic:iterate collection="ldmbean" id="crapValueObj", "moreCrapValueObj">
>// get data from both crapValueObj and moreCrapValueObj
></logic:iterate>
>
>
>
>
>Thanks 4 your time
>hemant
>
>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>