Any Loom tag (any tag that extends AbstractLoomTag) has an associated Decorator instance that gets called before and after the tag itself. Decorators are searched by looking for the tag class name, then each superclass.
The default decorator can be overriden using the "decorator" attribute. The default decorator for form fields will render the field label, input field, and associated error message, if any.
<!-- print the value after this hidden field --> <l:inputHidden name="mortgage.id" decorator="print"/> <!-- print label and field --> <l:inputText name="mortgage.name"/> <!-- print just the field, without label --> <l:inputText name="mortgage.address" decorator="none"/> <!-- print the field as text. No field will be written --> <l:inputText name="mortgage.address" renderAsText="true"/>
The default input field decorator uses some tag attributes to modify the generated HTML:
Some of these values can be changed in the containing form, in which case the value will be the default for all nested input fields.
New decorators can be registered at TagDecoratorRepository. The default list is as follows; to use them, just specify the decorator using the "decorator" attribute.
When renderAsText=true, the field will be rendered as output text, for display-only purposes. This means that instead of the usual label and text field, the browser will see something like this:
<p> <span>File name:</span> foo.txt </p>
When rendering as text, each component behaves different:
Internally, renderAsText is implemented using a ReadOnlyDecorator, so it can be overriden by specifying your own decorator instead.