This project has retired. For details please refer to its Attic page.
Apache Tiles - JSP support - Tag reference report. Fork me on GitHub

Tag reference sheet

Tag library reference for the following tag libraries:

tiles - version 1.2

Namespace definition: xmlns:tiles="http://tiles.apache.org/tags-tiles"

Tags

Required attributes are marked with a*

<tiles:addAttribute>

Add an element to the surrounding list. Equivalent to 'putAttribute', but for list element.

Add an element to the surrounding list. This tag can only be used inside 'putListAttribute' or 'addListAttribute' tags. Value can come from a direct assignment (value="aValue")

Can contain:scriptless

Attributes

Name Description Type
expression The expression to calculate the value from. Use this parameter, or value, or body. String
role A comma-separated list of roles. If present, the attribute will be rendered only if the current user belongs to one of the roles. String
type The type (renderer) of the attribute. String
value The value of the attribute. Use this parameter, or expression, or body. String

<tiles:addListAttribute>

Declare a list that will be pass as an attribute.

Declare a list that will be pass as an attribute . List elements are added using the tag 'addAttribute' or 'addListAttribute'. This tag can only be used inside 'insertTemplate', 'insertDefinition' or 'definition' tag.

Can contain:scriptless

Attributes

Name Description Type
role The comma-separated list of roles that can use the list attribute. String

<tiles:definition>

Create a definition at runtime.

Create a new definition at runtime. Newly created definition will be available across the entire request.

Can contain:scriptless

Attributes

Name Description Type
extends The definition name that this definition extends. String
name The name of the definition to create. If not specified, an anonymous definition will be created. String
preparer The preparer to use to invoke before the definition is rendered. String
role A comma-separated list of roles. If present, the definition will be rendered only if the current user belongs to one of the roles. String
template The template of this definition. String

<tiles:getAsString>

Render the value of the specified template attribute to the current Writer

Retrieve the value of the specified template attribute property, and render it to the current Writer as a String. The usual toString() conversions is applied on found value.

Can contain:scriptless

Attributes

Name Description Type
defaultValue The default value of the attribute. To use only if the attribute was not computed. String
defaultValueRole The default comma-separated list of roles. To use only if the attribute was not computed. String
defaultValueType The default type of the attribute. To use only if the attribute was not computed. String
ignore If true, if an exception happens during rendering, of if the attribute is null, the problem will be ignored. boolean
name* The name of the attribute. String
preparer The preparer to invoke before rendering the attribute. String
role A comma-separated list of roles. If present, the attribute will be rendered only if the current user belongs to one of the roles. String
value The attribute to use immediately, if not null. org.apache.tiles.Attribute

<tiles:importAttribute>

Import attribute(s) in specified context.

Import attribute(s) to requested scope. Attribute name and scope are optional. If not specified, all attributes are imported in page scope. Once imported, an attribute can be used as any other beans from jsp contexts.

Can contain:empty

Attributes

Name Description Type
ignore If true, if the attribute is not present, the problem will be ignored. boolean
name The name of the attribute to import. If it is null, all the attributes will be imported. String
scope The scope into which the attribute(s) will be imported. If null, the import will go in page scope. String
toName The name of the attribute into which the attribute will be imported. To be used in conjunction to name. If null, the value of name will be used. String

<tiles:insertAttribute>

Inserts the value of an attribute into the page.

This tag can be flexibly used to insert the value of an attribute into a page. As in other usages in Tiles, every attribute can be determined to have a "type", either set explicitly when it was defined, or "computed". If the type is not explicit, then if the attribute value is a valid definition, it will be inserted as such. Otherwise, if it begins with a "/" character, it will be treated as a "template". Finally, if it has not otherwise been assigned a type, it will be treated as a String and included without any special handling.

Example :

      <code>
                <tiles:insertAttribute name="body" />
              </code>
      

Can contain:scriptless

Attributes

Name Description Type
defaultValue The default value of the attribute. To use only if the attribute was not computed. String
defaultValueRole The default comma-separated list of roles. To use only if the attribute was not computed. String
defaultValueType The default type of the attribute. To use only if the attribute was not computed. String
flush If true, the response will be flushed after the insert. boolean
ignore If true, if an exception happens during rendering, of if the attribute is null, the problem will be ignored. boolean
name The name of the attribute. String
preparer The preparer to invoke before rendering the attribute. String
role A comma-separated list of roles. If present, the attribute will be rendered only if the current user belongs to one of the roles. String
value The attribute to use immediately, if not null. org.apache.tiles.Attribute

<tiles:insertDefinition>

Insert a definition.

Insert a definition with the possibility to override and specify parameters (called attributes). A definition can be seen as a (partially or totally) filled template that can override or complete attribute values. <tiles:insertDefinition> allows to define these attributes and pass them to the inserted jsp page, called template. Attributes are defined using nested tag <tiles:putAttribute> or <tiles:putListAttribute>.

You must specify name tag attribute, for inserting a definition from definitions factory.

Example :

      <code>
                <tiles:insertDefinition name=".my.tiles.defininition flush="true">
                   <tiles:putAttribute name="title" value="My first page" />
                   <tiles:putAttribute name="header" value="/common/header.jsp" />
                   <tiles:putAttribute name="footer" value="/common/footer.jsp" />
                   <tiles:putAttribute name="menu" value="/basic/menu.jsp" />
                   <tiles:putAttribute name="body" value="/basic/helloBody.jsp" />
                </tiles:insertDefinition>
              </code>
      

Can contain:scriptless

Attributes

Name Description Type
flush If true, the response will be flushed after the insert. boolean
name* The name of the definition to render. String
preparer The preparer to use to invoke before the definition is rendered. If specified, it overrides the preparer specified in the definition itself. String
role A comma-separated list of roles. If present, the definition will be rendered only if the current user belongs to one of the roles. String
template If specified, this template will be used instead of the one used by the definition. String
templateExpression The expression to evaluate to get the value of the template. String
templateType The type of the template attribute. String

<tiles:insertTemplate>

Insert a template.

Insert a template with the possibility to pass parameters (called attributes). A template can be seen as a procedure that can take parameters or attributes. <tiles:insertTemplate> allows to define these attributes and pass them to the inserted jsp page, called template. Attributes are defined using nested tag <tiles:putAttribute> or <tiles:putListAttribute>.

You must specify template attribute, for inserting a template

Example :

      <code>
                <tiles:insertTemplate template="/basic/myLayout.jsp" flush="true">
                   <tiles:putAttribute name="title" value="My first page" />
                   <tiles:putAttribute name="header" value="/common/header.jsp" />
                   <tiles:putAttribute name="footer" value="/common/footer.jsp" />
                   <tiles:putAttribute name="menu" value="/basic/menu.jsp" />
                   <tiles:putAttribute name="body" value="/basic/helloBody.jsp" />
                </tiles:insertTemplate>
              </code>
      

Can contain:scriptless

Attributes

Name Description Type
flush If true, the response will be flushed after the insert. boolean
preparer The preparer to use to invoke before the definition is rendered. If specified, it overrides the preparer specified in the definition itself. String
role A comma-separated list of roles. If present, the template will be rendered only if the current user belongs to one of the roles. String
template* The template to render. String
templateExpression The expression to evaluate to get the value of the template. String
templateType The type of the template attribute. String

<tiles:putAttribute>

Put an attribute in enclosing attribute container tag.

Enclosing attribute container tag can be :

  • <initContainer>
  • <definition>
  • <insertAttribute>
  • <insertDefinition>
  • <putListAttribute>
(or any other tag which implements the PutAttributeTagParent interface. Exception is thrown if no appropriate tag can be found.

Put tag can have following atributes :

  • name : Name of the attribute
  • value : value to put as attribute
  • type : value type. Possible type are : string (value is used as direct string), template (value is used as a page url to insert), definition (value is used as a definition name to insert), object (value is used as it is)
  • role : Role to check when 'insertAttribute' will be called.

Value can also come from tag body. Tag body is taken into account only if value is not set by one of the tag attributes. In this case Attribute type is "string", unless tag body define another type.

Can contain:scriptless

Attributes

Name Description Type
cascade If true the attribute will be cascaded to all nested attributes. boolean
expression The expression to calculate the value from. Use this parameter, or value, or body. String
name* The name of the attribute to put. String
role A comma-separated list of roles. If present, the attribute will be rendered only if the current user belongs to one of the roles. String
type The type (renderer) of the attribute. String
value The value of the attribute. Use this parameter, or expression, or body. String

<tiles:putListAttribute>

Declare a list that will be pass as attribute to tile.

Declare a list that will be pass as attribute to tile. List elements are added using the tags 'addAttribute' or 'addListAttribute'. This tag can only be used inside 'insertTemplate', 'insertDefinition', 'definition' tags.

Can contain:scriptless

Attributes

Name Description Type
cascade If true the attribute will be cascaded to all nested attributes. boolean
inherit If true, the list attribute will use, as first elements, the list contained in the list attribute, put with the same name, of the containing definition. boolean
name* The name of the attribute to put. String
role A comma-separated list of roles. If present, the attribute will be rendered only if the current user belongs to one of the roles. String

<tiles:setCurrentContainer>

Selects a container to be used as the "current" container.

Can contain:empty

Attributes

Name Description Type
containerKey The key of the container to be used as "current". If null, the default one will be used. String

tilesx - version 1.2

This tag library provides Tiles tags.

Namespace definition: xmlns:tilesx="http://tiles.apache.org/tags-tiles-extras"

Tags

Required attributes are marked with a*

<tilesx:useAttribute>

Use attribute value inside page.

Declare a Java variable, and an attribute in the specified scope, using its attribute value.

Java variable and attribute will have the name specified by 'id', or the original name if not specified.

Can contain:empty

Attributes

Name Description Type
classname

Class of the declared variable.

String
id

Declared attribute and variable name.

String
ignore

If this attribute is set to true, and the attribute specified by the name does not exist, simply return without error. The default value is false, which will cause a runtime exception to be thrown.

boolean
name*

Attribute name.

String
scope

Scope of the declared attribute. Default to 'page'.

String