You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Reinhold Gruber <r....@deltavista.at> on 2005/04/04 11:20:35 UTC
Foreach-Troubles
I have the following in a page template:
<loop jwcid="ownCredits@Foreach" source="ognl:person.ownCredits">
<span jwcid="@CreditRenderer"
credit="ognl:components.ownCredits.value"/>
</loop>
person.ownCredits is an array with 3 items.
CreditRenderer.renderComponent(..) is called 3 times,
but always on the same CreditRenderer-Instance!!. I verified this by
putting a System.out.println() in the Default-Constructor of
CreditRenderer.
This issue causes problems because I lazy initialize some properties in
CreditRenderer and reseting them by implementing PageDetachListener.
Reinhold
RE: Foreach-Troubles
Posted by David Leangen <dl...@canada.com>.
I think you need to declare a "value" attribute in your loop component:
<loop jwcid="ownCredits@Foreach" source="ognl:person.ownCredits"
value="ognl:credit>
<span jwcid="@CreditRenderer" credit="ognl:credit"/>
</loop>
And don't forget to declare a specification-property in your .page file.
HTH
Dave
> -----Original Message-----
> From: Reinhold Gruber [mailto:r.gruber@deltavista.at]
> Sent: 4 April 2005 18:21
> To: Tapestry users
> Subject: Foreach-Troubles
>
>
> I have the following in a page template:
>
>
>
>
>
> <loop jwcid="ownCredits@Foreach" source="ognl:person.ownCredits">
>
> <span jwcid="@CreditRenderer"
> credit="ognl:components.ownCredits.value"/>
>
> </loop>
>
>
>
> person.ownCredits is an array with 3 items.
> CreditRenderer.renderComponent(..) is called 3 times,
>
> but always on the same CreditRenderer-Instance!!. I verified this by
> putting a System.out.println() in the Default-Constructor of
> CreditRenderer.
>
> This issue causes problems because I lazy initialize some properties in
> CreditRenderer and reseting them by implementing PageDetachListener.
>
>
>
> Reinhold
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org