Thanks Thiago, I'll try that. I did first look at the Tapestry docs, and saw that the template parameter was of type org.apache.tapestry5.services. dynamic.DynamicTemplate and I had not idea what to do what that.
On Tue, May 7, 2013 at 11:22 AM, Thiago H de Paula Figueiredo < [email protected]> wrote: > On Tue, 07 May 2013 14:12:52 -0300, George Ludwig <[email protected]> > 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-unsubscribe@tapestry.**apache.org<[email protected]> > For additional commands, e-mail: [email protected] > >
