Hello,

Thank you for your answer.

Unfortunately I can't put the components in my template.
So I guess I had not the right approach.

I solved the problem by using pages instead of components.
As I wanted to take advantage of Tapestry zones behaviour on the client, I
had to encapsulate the generated markup into a JSON object (by advising the
PageRenderResponse service), and send that object as a response to the
browser.

Clément

2011/6/3 Thiago H. de Paula Figueiredo <thiag...@gmail.com>

> On Fri, 03 Jun 2011 15:33:19 -0300, Clément Uster <clement.us...@gmail.com>
> wrote:
>
>  Hi all,
>>
>
> Hi!
>
>
>  I could wrap all my component into Tapestry Blocks (in my page), and then
>> return the block at the end of the @OnEvent method.
>> But I can't do this, because in some cases, the page may not know all the
>> component names. Do you know how I could do this ?
>>
>
> Notice you cannot instantiate components by yourself, so you need to
> include them in a template.
>
> Try this:
>
> @Inject
> private ComponentResources resources;
>
> @OnEvent(EventConstants.ACTION)
> public Object renderComponent(String componentId){
>        return resources.getEmbeddedComponent(componentid);
> }
>
> Note that that code needs you to have these components somewhere in your
> template. In addition, it's based in component ids, not in component names,
> but, without a t:id attribute, the component id is the component name
> (except when there's more than one id-less instance of the same component).
>
> --
> Thiago H. de Paula Figueiredo
> Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,
> and instructor
> Owner, Ars Machina Tecnologia da Informação Ltda.
> http://www.arsmachina.com.br
>

Reply via email to