>
> I am trying to pass services into my components via parameters, i.e. I want
> something like:
>
> <div t:type="doofer" t:controller="service:dooferController"/>
>

What does the text "dooferController" represent in this context? Is it
a string that represents the name of the service interface that you
want to load? or is it a property in your page that holds a reference
to the service implementation?

Are you trying to avoid injecting the "dooferController" in the
page/parent component and simply passing it without the special
binding?

If for instance you were building a graphing app and had
BarChartService, PieChartService and ScatterPlotService and needed to
use the service in the page and some child components; I would have
their individual service interfaces implement a base ChartService
interface. With a ChartService property in the page holding the chosen
implementation you can pass them to the component using the standard
property bindings built into tapestry.

If you really want to build a binding for looking up services then try
using Class.forName() and passing the actual name of the service
interface you want to pull:

<div t:type="doofer" t:controller="service:DooferController"/>

since you know where your services live
(your.tapestry.package.services) you can append the passed name, or
pass a fully qualified path... or you could get really configurable
and add configuration with several paths to prepend.

Good luck,
Josh

On Fri, Sep 18, 2009 at 2:11 AM, david.boyce
<david.bo...@thisisnumero.com> wrote:
>
> I am trying to pass services into my components via parameters, i.e. I want
> something like:
>
> <div t:type="doofer" t:controller="service:dooferController"/>
>
> Where service is some custom binding type and dooferController is a service
> I've defined in my application module.
>
> The problem is that the only way I know of getting hold of a service is via
> the Registry, which requires a type (as opposed to a spring application
> context) and in my BindingFactory, I don't have access to the type of the
> parameter, so exactly how to retrieve the service is unclear.
>
> At the moment, I've implemented something that works, but via accessing the
> RegistryWrapper's underlying Registries allServiceDefs collection, which
> seems a bit fragile and not ideal for non-singleton services.
>
> Anybody got any ideas?
>
> Cheers
>
> David
> --
> View this message in context: 
> http://www.nabble.com/passing-a-service-into-a-component-as-a-parameter-tp25505462p25505462.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>



-- 
--
TheDailyTube.com. Sign up and get the best new videos on the internet
delivered fresh to your inbox.

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

Reply via email to