Tag library reference for the following tag libraries:
This tag library provides Tiles tags.
This is version 2.0.
Required attributes are marked with a *
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: JSP
Name | Description | Type |
---|---|---|
role |
If the user is in the specified role, the tag is taken into account; otherwise, the tag is ignored (skipped). |
String |
type |
Specify content type: string, template or definition.
|
String |
value |
Attribute value. Can be a String or Object. |
String |
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: JSP
This tag has no attributes.
Create a definition at runtime.
Create a new definition at runtime. Newly created definition will be available across the entire request.
Can contain: JSP
Name | Description | Type |
---|---|---|
extends |
Name of a parent definition that is used to initialize this new definition. Parent definition is searched in definitions factory. |
String |
name* |
Specifies the name under which the newly created definition bean will be saved. |
String |
preparer |
Specifies the preparer name to use. The specified preparer will be executed before rendering this newly created definition. |
String |
role |
Role to check before inserting this definition. If role is not defined for current user, definition is not inserted. Checking is done at insert time, not during definition process. |
String |
template |
A string representing the URI of a template (a JSP page). |
String |
Destroy the TilesContainer.
Can contain: empty
This tag has no attributes.
Render the value of the specified template attribute to the current JspWriter
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.
Can contain: empty
Name | Description | Type |
---|---|---|
ignore |
If this attribute is set to true, and the attribute specified by the name does not exist, simply return without writing anything. The default value is false, which will cause a runtime exception to be thrown. |
boolean |
name* |
Attribute name. |
String |
role |
If the user is in the specified role, the tag is taken into account; otherwise, the tag is ignored (skipped). |
String |
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
Name | Description | Type |
---|---|---|
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. If not specified, all attributes are imported. |
String |
scope |
Scope into which attribute is imported. Default to page. |
String |
toName |
Name of the destination bean. If not specified, the name will be the same as specified in name attribute |
String |
Initialize the TilesContainer.
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.
Can contain: JSP
Name | Description | Type |
---|---|---|
containerFactory | Container Factory implementation used to instantiate the container. |
String |
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 :
<tiles:insertAttribute name="body" />
Can contain: JSP
Name | Description | Type |
---|---|---|
flush |
True or false. If true, current page out stream is flushed before insertion. |
boolean |
ignore |
If this attribute is set to true, and the attribute specified by the name does not exist, simply return without writing anything. The default value is false, which will cause a runtime exception to be thrown. |
boolean |
name |
Name of the attribute to insert. This attribute will be ignored if the value attribute is specified. |
String |
preparer | The fully qualified name of the preparer. | String |
role |
If the user is in the specified role, the tag is taken into account; otherwise, the tag is ignored (skipped). |
String |
value |
Attribute object to render directly. If it specified, the name attribute will be ignored. |
String |
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 :
<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>
Can contain: JSP
Name | Description | Type |
---|---|---|
flush |
True or false. If true, current page out stream is flushed before insertion. |
boolean |
ignore |
If this attribute is set to true, and the attribute specified by the name does not exist, simply return without writing anything. The default value is false, which will cause a runtime exception to be thrown. |
boolean |
name* |
Name of the definition to insert. |
String |
preparer | The fully qualified class name of preparer. | String |
role |
If the user is in the specified role, the tag is taken into account; otherwise, the tag is ignored (skipped). |
String |
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 :
<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>
Can contain: JSP
Name | Description | Type |
---|---|---|
flush |
True or false. If true, current page out stream is flushed before insertion. |
boolean |
ignore |
If this attribute is set to true, and the attribute specified by the name does not exist, simply return without writing anything. The default value is false, which will cause a runtime exception to be thrown. |
boolean |
preparer | The fully qualified class name of the preparer. | String |
role |
If the user is in the specified role, the tag is taken into account; otherwise, the tag is ignored (skipped). |
String |
template* |
A string representing the URI of a template (for example, a JSP page). |
String |
Put an attribute in enclosing attribute container tag.
Enclosing attribute container tag can be :
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.
Can contain: JSP
Name | Description | Type |
---|---|---|
name* |
Name of the attribute. |
String |
role |
If the user is in the specified role, the tag is taken into account; otherwise, the tag is ignored (skipped). |
String |
type |
Specify content type: string, template or definition.
|
String |
value |
Attribute value. Could be a String or an Object. |
String |
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: JSP
Name | Description | Type |
---|---|---|
name* |
Name of the list. |
String |
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
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 |