You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Steve <sm...@neca.com> on 2002/09/13 22:54:34 UTC

Newbie and use of

Not sure this posted the first time. Sorry in advance if it did.


I have checked the archives and I can still not seem to find a clear way
of how to accomplish the following. I have a collection of beans added
to the request:

request.setAttribute("allFoo", foos);

The beans have a property called 'someIds'( this is a List of id's) ,
along with other properties like name, desc, etc. In my .jsp I simply
need to iterate over the collection of beans displaying the properties
and where applicable iterate over 'someIds'. I have something similar to
this currently:

<logic:iterate name="allFoo" id="aFoo">
    <bean:write name="aFoo" property="title"/>
    <bean:write name="aFoo" property="name"/>
    <bean:write name="aFoo" property="desc"/>
    <logic:iterate name="allFoo" id="sid">
        <bean:write name="sid" property="someIds"/>
    </logic:iterate>
</logic:iterate>

This does not give me the desired result though. Can someone shed some
light on what it is I am doing incorrectly? It seems like a fairly
common thing that I want to do. 

Thanks.

steve


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


Re: Newbie and use of

Posted by Bryan Hilterbrand <Br...@bullwinkle.net>.
Try this:

    <logic:iterate id="sid" name="allFoo" property="someIds">
        <bean:write name="sid" property="id"/>
    </logic:iterate>

"someIds" is a Collection of beans.  "id" property on an individual bean.
This will work with arrays also, but then you have to specify the type
in the logic:iterate tag.

Bryan

----- Original Message -----
From: "Steve" <sm...@neca.com>
To: <st...@jakarta.apache.org>
Sent: Friday, September 13, 2002 2:54 PM
Subject: Newbie and use of <logic:iterate>


Not sure this posted the first time. Sorry in advance if it did.


I have checked the archives and I can still not seem to find a clear way
of how to accomplish the following. I have a collection of beans added
to the request:

request.setAttribute("allFoo", foos);

The beans have a property called 'someIds'( this is a List of id's) ,
along with other properties like name, desc, etc. In my .jsp I simply
need to iterate over the collection of beans displaying the properties
and where applicable iterate over 'someIds'. I have something similar to
this currently:

<logic:iterate name="allFoo" id="aFoo">
    <bean:write name="aFoo" property="title"/>
    <bean:write name="aFoo" property="name"/>
    <bean:write name="aFoo" property="desc"/>
    <logic:iterate name="allFoo" id="sid">
        <bean:write name="sid" property="someIds"/>
    </logic:iterate>
</logic:iterate>

This does not give me the desired result though. Can someone shed some
light on what it is I am doing incorrectly? It seems like a fairly
common thing that I want to do.

Thanks.

steve


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




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