On Tue, 07 May 2013 14:12:52 -0300, George Ludwig <georgelud...@gmail.com> wrote:

I'm trying to use the Dynamic component so I can specify the tml at runtime.

Notice the template parameter is of type Asset, so that's what you should pass to it. The default binding is 'asset', and I guess you overlooked this important fact. Use the AssetSource service instead. Something like this:

@Inject
private AssetSource assetSource;

public Asset getTemplate() {
        // use AssertSource to get the Asset
}

<t:dynamic template="prop:template"/>

These work:

<t:dynamic template="myTemplate.tml" ...

<t:dynamic template="asset:myTemplate.tml" ...


But I need to read the template name from a property. Unfortunately, these
do not work:

<t:dynamic template="templateName" ... (where templateName is a String
property)

It won't work because the default binding of the parameter is Asset.

<t:dynamic template="${templateName}" ... (where templateName is a String
property)

Never, never, never ever use expansions when passing component parameter values.

<t:dynamic template="prop:templateName" ... (where templateName is a String property)

It won't work because the default binding of the parameter is Asset.

<t:dynamic template="asset:templateName}" ... (where templateName is a
String property)

The asset binding doesn't support properties.

<t:dynamic template="asset:${templateName}" ... (where templateName is a
String property)

The asset binding doesn't support ${}

--
Thiago H. de Paula Figueiredo

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

Reply via email to