Hi Mark,
You're right, it does not work. I have tried this too:
<s:bean name="test.Door" id="i"></s:bean>
<s:bean name="test.House" id="iter"/>
<s:iterator value="#iter.list">
<s:property value="#i.color"/>
</s:iterator>
thanks
Mark Menard wrote:
>
> On 12/27/06 2:38 PM, "cvu" <[EMAIL PROTECTED]> wrote:
>
>>
>> Hi,
>> Anyone knows how to iterate over a collection of object each object has
>> string property:
>> public class Door {
>> String color;
>> public void setColor(String color){
>> this.color=color;
>> }
>> public String getColor(){
>> return color;
>> }
>> }
>> public class House {
>> List list= new ArrayList();
>> public House(){
>> list.add(new Door().setColor("red");
>> list.add(new Door().setColor("blue");
>> }
>> public void setDoor(Door d) {
>> list.add(d);
>> }
>> public List getList(){
>> return list;
>> }
>> }
>> Would any guru shows me how to use struts2 s:iterator to iterate over a
>> collection of Door to show the color of it ?
>> Thanks a million
>
> Assuming your House is available using a getHouse() method on your Action
> class:
>
> <s:iterator value="%{house.list}">
> <s:property value="%{color}" />
> </s:iterator>
>
> That's off the top of my head, and I haven't tested it. You also might not
> need the %{} on these. I don't remember at the moment. I'm tired and out
> of
> S2 practice having spent too much time getting a Xen setup running.
>
> Mark
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
--
View this message in context:
http://www.nabble.com/struts2-bean-and-iterator-tf2887373.html#a8074858
Sent from the Struts - Dev mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]