Renderer components are looked up in net.twiff.renderer.components by default. The order can be modified or added on for custom components using the twiff.renderer.component.path initialization parameter.

The default component is Property which returns a property in the page bean. The page bean is a request attribute that is defaulted to "twiff.page.bean" which can be configured to be something else using the "twiff.page.bean" initialization parameter.

A component is invoked using the following format:

[ComponentClassName]:[parameters]

The renderer actually converts an XML file into a CompositePageData which gets cached. PageData is an interface which is either StringPageData in which case the accept(PageDataVisitor) method will return contents of the string and ComponentPageData in which the write component will evaluate the results. Since CompositePageData is also a PageData it can be included within itself to handle includes.

Standard components

  • Property - runs OGNL on the page bean, if it is a Collection or an array it will parse the XML inside and repeat it for every page bean element. Please note the XML inside will only support simple properties and custom components. But it will still support the special components. Please note for each element it will render one data at a time, this will allow you to specify two different elements and you can specify alternating colors if you so wish, but you still require to put in the component tags for each one. Property requests inside the list would be evaluated against the list item data, if it returns null it looks up the page bean or the parent list if it is a list within a list, this is the same for Attribute and AttributeLink.
  • Attribute - adds/replaces an attribute in an element with data from the page bean
  • Link - Modifies the href attribute to contain the token value if one is available. It also rewrites for cookie-less sessions. If a parameter is specified it will be an OGNL lookup on the bean and will be used as the link value.
  • Src - Modifies the src or data attribute to contain the token value if one is available. This is primarily used with IMG, OBJECT or EMBED. It also rewrites for cookie-less sessions. If a parameter is specified it will the replacement URL.
  • Token - this replaces the tag with <input type="hidden" name="twiff.token" value="tokenValue" />.
  • Pico - runs OGNL on the picocontainer stored in the request, up to the first ',' character is the class name.
  • PicoName - runs OGNL on the picocontainer stored in the request, up to the first ',' character is lookup key as a string.
  • IncludeFileAsIs - includes another file into the processing.
  • IncludeFile - includes another file into the processing. Up to the first "," is the tag to include from.
  • Include - includes another file into the processing. The second attribute is an OGNL lookup to get the property from the bean which specifies the file name. Up to the first "," is the tag to include from.
  • IncludeAsIs - includes another file into the processing. The second attribute is an OGNL lookup to get the property from the bean which specifies the file name.

Special directives

Special directives begin with the "$" character

  • $remove - removes the element and all its children from being rendered.