Insert a tiles/component/template with the possibility to pass
parameters (called attribute). A tile can be seen as a procedure that
can take parameters or attributes. <tiles:insert>
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 one of this tag attribute :
template
, for inserting a
tiles/component/template page,component
, for inserting a
tiles/component/template page, (same as template)page
for inserting a JSP page,
(same as template)definition
, for inserting a definition from
definitions factoryattribute
, surrounding tiles's attribute name
whose value is used.name
, to let 'insert' determine the type of
entities to insert. In this later case, search is done in
this order : definitions, tiles/components/templates, pages.In fact, Page, component and template, are equivalent as a tile, component or template are jsp page.
Example :
<tiles:insert page="/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>
]]>
'page', 'component' and 'template' are synonyms : they have exactly the same behavior.
]]>'page', 'component' and 'template' are synonyms : they have exactly the same behavior.
]]>'page', 'component' and 'template' are synonyms : they have exactly the same behavior.
]]><tiles:definition>
, use beanName="".
]]>
If found bean (or property value) is instance of one of Attribute class (Direct, Instance, ...), insertion is done according to the class type. Otherwise, the toString method is called on the bean, and returned String is used as name to insert (see 'name' attribute).
]]>Url usually denote a Struts action. Controller (action) is used to prepare data to be render by inserted Tile.
See also controlerClass. Only one of controllerUrl or controllerClass should be used.
]]>Controller is used to prepare data to be render by inserted Tile.
See also controlerUrl
Class must implements or extends one of the following :
See also controllerUrl. Only one of controllerUrl or controllerClass should be used.
]]>Create a tile/component/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
Define an attribute to pass to tile/component/template. This tag can only be used inside 'insert' or 'definition' tag. Value (or content) is specified using attribute 'value' (or 'content'), or using the tag body. It is also possible to specify the type of the value :
If 'type' attribute is not specified, content is 'untyped', unless it comes from a typed bean.
Note that using 'direct="true"' is equivalent to 'type="string"'.
]]><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.
Retrieve content from tile context and include it.
Take into account the 'type' attribute.
]]>Retrieve the value of the specified tile/component/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.
]]>In order to use Tile/Component definitions factory, you need to initialize the factory. This is generally done in a initializing servlet. In particular, it is done in "ComponentActionServlet" if you use it. If you don't initialize factory in a servlet, you can initialize it using this tag. You need to provide the description file name, and optionally the factory classname. Initialization is done only once, at the first call of this tag. Subsequent calls are ignored (tag checks existence of the factory).
]]>