You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Ed Cohen <ec...@powersteeringsoftware.com> on 2005/09/27 18:20:04 UTC

How to clear the body of an injected component

I have a component that is rendered in java code.  The main part has a
loop that renders a DirectLink on each iteration.

 

I obtain the DirectLink by injection, and want to set its body and then
render it.  I tried getting the DirectLink, then calling addBody to set
its body, and then rendering.  What I found was that the same DirectLink
component was being returned because its body was the accumulated body
from all previous iterations of my loop.  It was kind of cool looking
but wrong.

 

Is there a way to clear the body, or alternatively, to get a different
DirectLink each time?

 

Thanks in advance.

 


Re: How to clear the body of an injected component

Posted by Howard Lewis Ship <hl...@gmail.com>.
Remember:  In Tapestry, its a static structure and a dynamic behavior.

I think what you want to do is render an <a> tag that generates a URL
using the direct service.  You can do this in Java code (by injecting
the DirectService).  Make your component implement IDirect.

On 9/27/05, Ed Cohen <ec...@powersteeringsoftware.com> wrote:
> I have a component that is rendered in java code.  The main part has a
> loop that renders a DirectLink on each iteration.
>
>
>
> I obtain the DirectLink by injection, and want to set its body and then
> render it.  I tried getting the DirectLink, then calling addBody to set
> its body, and then rendering.  What I found was that the same DirectLink
> component was being returned because its body was the accumulated body
> from all previous iterations of my loop.  It was kind of cool looking
> but wrong.
>
>
>
> Is there a way to clear the body, or alternatively, to get a different
> DirectLink each time?
>
>
>
> Thanks in advance.
>
>
>
>
>


--
Howard M. Lewis Ship
Independent J2EE / Open-Source Java Consultant
Creator, Jakarta Tapestry
Creator, Jakarta HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com

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