Class Dynamic


  • @SupportsInformalParameters
    public class Dynamic
    extends Object
    The Dynamic component allows a component to render itself differently at different times, by making use of an external template file. The content of the template file replaces the Dynamic component entirely with one exception: certain elements will be replaced with Blocks passed to the Dynamic component as informal parameters; this is triggered by id of the element. When the id attribute has the prefix param:, the remainder is the name of a Block parameter. There are no limitations on what can appear inside such a Block: text, components, forms, even the <t:body/> directive. Dynamic templates emulate how expansions work in standard Tapestry templates: Expansions (the ${ ... } syntax) can appear in attribute values or interspersed in element text. This allows container properties, messages, assets, and so forth to be referenced within the external template. It should be noted that such access is quite a bit less efficient than putting such expansions inside a referenced Block, but this should not be a big concern outside of some kind of tight rendering loop.
    Since:
    5.3
    See Also:
    DynamicTemplate, DynamicTemplateParser
    Component Parameters 
    NameTypeFlagsDefaultDefault Prefix
    templateorg.apache.tapestry5.services.dynamic.DynamicTemplateRequired, Not Null asset
    The dynamic template containing the content to be rendered by the component.
    • Constructor Detail