I am using the delegate, but it's getting the "to-component" of delegate that I 
need to do at runtime. I cannot already have the "to-component" declared with 
@Inject because I do not know what it is till runtime.


----- Original Message ----
From: Thiago H. de Paula Figueiredo <thiag...@gmail.com>
To: Tapestry users <users@tapestry.apache.org>
Sent: Friday, February 6, 2009 5:57:53 AM
Subject: Re: [T5] Dynamically getting a component from IoC

On Thu, Feb 5, 2009 at 10:33 PM, Dave Greggory <davegregg...@yahoo.com> wrote:
> Is it possible dynamically (programmatically) request a component from 
> tapestry's IoC (without using @Inject or passing component via parameter)?
>
> I have this MyComponentInterface and a whole bunch of components that 
> implement it (ie. MyComponent1, MyComponent2, etc). I do not know until 
> runtime if any of these components will be rendered or exactly which 
> implementation will be used. On top of that, MyComponent1 may be rendered 
> multiple times (each time with a different configuration) and I do not know 
> the number of times till runtime either.
>
> So, is it possible to grab a component from IoC at runtime?

AFAIK, no. Components are handled outside Tapestry-IoC. I suggest you
to use blocks and the Delegate component to accomplish what you want.
There's a simple example at
http://tapestry.apache.org/tapestry5/tapestry-core/ref/org/apache/tapestry5/corelib/components/Delegate.html.

-- 
Thiago

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org


      


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to