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:put>
or
<tiles:putList>
.
You must specify
template
attribute, for inserting a template
Example :
<tiles:insertTemplate template="/basic/myLayout.jsp" flush="true">
<tiles:put name="title" value="My first page" />
<tiles:put name="header" value="/common/header.jsp" />
<tiles:put name="footer" value="/common/footer.jsp" />
<tiles:put name="menu" value="/basic/menu.jsp" />
<tiles:put name="body" value="/basic/helloBody.jsp" />
</tiles:insert>
]]>
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:put>
or
<tiles:putList>
.
You must specify name
tag attribute, for inserting a definition from
definitions factory.
Example :
<tiles:insertDefinition name=".my.tiles.defininition flush="true">
<tiles:put name="title" value="My first page" />
<tiles:put name="header" value="/common/header.jsp" />
<tiles:put name="footer" value="/common/footer.jsp" />
<tiles:put name="menu" value="/basic/menu.jsp" />
<tiles:put name="body" value="/basic/helloBody.jsp" />
</tiles:insertDefinition>
]]>
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 :
]]>
value
attribute is specified.
]]>
name
attribute will be ignored.
]]>
Create a template definition as a bean.
Newly created bean will be saved under specified "id", in the requested "scope".
Definition tag has same syntax as insert
Enclosing attribute container tag can be :
{@link PutAttributeTagParent}
interface.
Exception is thrown if no appropriate tag can be found.
Put tag can have following atributes :
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.
]]><tiles:insert attribute="attributeName">
tag, where 'attributeName'
is the name used for this tag.Declare a list that will be pass as attribute to tile. List elements are added using the tag 'add'. This tag can only be used inside 'insert' or 'definition' tag.
]]>Add an element to the surrounding list. This tag can only be used inside putList tag. Value can come from a direct assignment (value="aValue") or from a bean. One of 'value' or 'beanName' must be present.
]]><insert attribute="attributeName">
tag, where 'attributeName'
is the name used for this tag.The role isn't taken into account if <add>
tag is used in a definition.
Declare a list that will be pass as attribute to tile. List elements are added using the tag 'add'. This tag can only be used inside 'insert' or 'definition' tag.
]]>Retrieve the value of the specified template attribute property, and render it to the current JspWriter as a String. The usual toString() conversions is applied on found value.
Throw a JSPException if named value is not found.
]]>Declare a Java variable, and an attribute in the specified scope, using tile attribute value.
Java variable and attribute will have the name specified by 'id', or the original name if not specified.
]]>Import attribute from tile to requested scope. Attribute name and scope are optional. If not specified, all tile attributes are imported in page scope. Once imported, an attribute can be used as any other beans from jsp contexts.
]]>name
attribute
]]>
In order to use the Tiles system, a TilesContainer must be instantiated. This initialization is generally done by the TilesListener (or perhaps the TilesServlet or TilesFilter).
If the intialization needs to be dynamic, you can initialize the container using this tag. Realize however, that this tag MUST be executed prior to invoking any other definitions. Additionally, the initilization may only be done once, and any subsequent invocations will be ignored.
]]>