Magnolia 4.5 reached end of life on June 30, 2016. This branch is no longer supported, see End-of-life policy.

Page tree
Skip to end of metadata
Go to start of metadata

Template and paragraph definition

Prior to 4.0, the template and paragraph definition were only represented through instances of the Template and Paragraph classes. Since 4.0, those are instanciated with content2bean, and consequently, you can define and use your own subclasses. This can be useful, for example, if your templates or paragraphs need specific configuration that you don't want to expose to editors in dialogs: the same jsp and the same dialog can be re-used to render totally different looking paragraphs. Definition classes are loaded once, instances are reused across rendering.

Template and paragraph model/action

The action concept that was introduced in 3.5 for Freemarker-based paragraphs has been generalized and is now available for both paragraphs and templates, using any templating language. We have renamed this to "model", because while it can indeed be mapped to the same concept action-based frameworks use, it can also be used outside the context of a concrete user action. Model classes are instanciated per rendering. As such, they can be used to perform actions based on input, load some data, or simply provide utility methods to the templates.

Templating support objects

We also introduced a couple of objects that are made available to templates, to simplify their development:


The current node exposed as a map like cms:setNode.

page or actpage

The current page node, exposed as a map like cms:setNode. This attribute is called actpage in JSPs because the page name is reserved.


The current RenderableDefinition . (template or paragraph definition object)


The bean created by the renderer based on the modelClass defined on the paragraph or template definition. The current content, definition and the parent model are passed to the constructor.


The result of the model's execute method. This string can be used to determine the template (in the definition) or in the template itself.


An object providing access to various components or utility methods - see MagnoliaTemplatingUtilities - partially replacing the taglibs.


The current Context .


The current AggregationState .


  • No labels