The Tiles Tag Library

This section introduces the JSP custom tags used by the Tiles framework. Table 14-1 lists the tags available to the framework. The tags are very similar to the ones provided in any template-based framework, but Tiles contains more functionality.

Table 14-1. Tags within the Tiles tag library

Tag name

Description

add

Add an element to the surrounding list.

definition

Create a tile component definition.

get

Get the content from request scope that was put there by a put tag.

getAsString

Render the value of the specified tile/component/template attribute to the current JspWriter.

importAttribute

Import a tile’s attribute into the specified context.

initComponentDefinitions

Initialize a tile definitions factory.

insert

Insert a tiles component.

put

Put an attribute into a tile context.

putList

Declare a list that will be passed as an attribute.

useAttribute

Use an attribute value inside a page.

The insert Tag

The insert tag is responsible for inserting content into a page. In a layout tile, the insert tag prescribes where the content will go using attribute values. In a regular, non-layout tile, the insert tag is used to retrieve a layout and allow content to be passed to the layout using put tags. Table 14-2 lists the attributes for the insert tag.

Table 14-2. Attributes for the insert tag

Attribute name

Description

attribute

The name of an attribute in the current tile/component context. The value of this attribute ...

Get Programming Jakarta Struts now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.