Properties for Struts tiles tags

This documentation describes the properties for the elements that are defined in the Struts tiles tag library. By default, the name of each of these elements has a tiles: prefix.

Each Struts element has a number of properties that you can set by using the element's Properties view. Use this table of properties while working with the element's Properties view, to look up properties for which you want additional detail. Some properties have the same name but different usage in different elements. The properties are listed in alphabetical order.

Element Property Description
add beanName Specifies the name of the bean whose value is to be used. The bean is retrieved from the specified context, if any. Otherwise, method pageContext.findAttribute is used. If you specify beanProperty, the value is retrieved from the corresponding bean property.
beanProperty Specifies the name of a bean property whose value is to be retrieved. This attribute supports nested and indexed properties.
beanScope Specifies the scope in which the bean is searched for. By default, the method pageContext.findAttribute is used. The scope can be any JSP scope, component, or template. In the latter two cases, the bean is searched for in the tile context.
content Is a synonym for value.
direct Specifies how content is handled: true means that content is contained in the file; false, the default, means that content is included from elsewhere. This is another way to specify content type. If you specify true, the content is interpreted as a string; otherwise, the content is interpreted as a page. This attribute exists for compatibility with the JSP template.
role Specifies a role that makes the element conditional. If the user is not in the specified role, the element is ignored, unless it is being used in a definition.
type Specifies one of the following content types:

definition

Specifies a definition that is defined in factory (XML file). The definition will be searched in the inserted tile, in an <insert attribute="attributeName"> tag, where attributeName is the name used for this tag.

page

Includes content from a specified URL. A synonym for this attribute is template.

string

Provides content directly.
If you omit the type attribute, the content is untyped unless it comes from a typed bean.
value Specifies the value of an element. The value can be a string or an object.
definition extends Specifies the name of a parent definition that is used to initialize this new definition. The parent definition is searched in definitions factory.
id Specifies the name under which the newly created definition bean will be saved.
page Specifies URL of a tiles layout file (a type of JSP file) to insert.
role Specifies the role to check before inserting this definition. If role is not defined for current user, the definition is not inserted. Checking is done at insertion time, not during the definition process.
scope Specifies the variable scope into which the newly defined bean will be created. If you omit this attribute, the bean will be created in page scope.
template Is a synonym for page.
get flush If true, flushes the current page out stream before inserting a new page. The default is false.
ignore Returns without writing anything if the value of this attribute is true and the content specified by name does not exist. The default value is false, which causes a run-time exception to be thrown if the name content does not exist.
name Specifies the name of the content to get from the tile scope.
role Causes the element to be ignored if the user is not in the specified role.
getAsString ignore Returns without writing anything if the value of this attribute is true and the attribute specified by name does not exist. The default value is false, which causes a run-time exception to be thrown if the attribute does not exist.
name Specifies an attribute name.
role Causes the element to be ignored if the user is not in the specified role.
importAttribute ignore Returns without error if the value of this attribute is true and the attribute specified by name does not exist. The default value is false, which causes a run-time exception to be thrown if the attribute does not exist.
name Specifies the name of the attribute to be imported. By default all attributes are imported.
scope Specifies the scope into which the attribute is imported. The default is page.
initComponentDefinitions classname Specifies the class name of the factory to create and initialize.
file Specifies the name of the definition file.
insert attribute Specifies the name of an attribute in the current tile context. The value of this attribute is passed to name (see the description below).
beanName Inserts according to class type if the bean or property value found is an instance of one of Attribute class (Direct, Instance, and so forth). Otherwise, the toString method is called on the bean, and the returned String class is used as name to insert (see name below).
beanProperty Specifies the name of a bean property whose value is to be retrieved. This attribute supports nested and indexed properties.
beanScope Specifies the scope in which the bean is searched for. By default, the method pageContext.findAttribute is used. The scope can be any JSP scope, component, or template. In the latter two cases, the bean is searched for in the tile context.
component Specifies a string that represents the URI of a tile to insert.
controllerClass Specifies the Java class type of a controller called immediately before the page is inserted. The controller prepares data to be rendered by the inserted tile. The class must implement or extend one of the following classes:

You cannot use controllerClass with controllerUrl.

controllerUrl Specifies the URL of a controller that is called immediately before the page is inserted. The URL usually denotes a Struts action. The controller (action) is used to prepare data to be rendered by the inserted tile. You cannot use controllerUrl with controllerClass.
definition Specifies the name of the definition to insert. Definitions are defined in a centralized file. This attribute can insert only definitions from a factory. To insert a definition defined with tag <tiles:definition>, use beanName="".
flush If set to true, flushes the current page output stream before insertion.
ignore Returns without writing anything if the value of this attribute is true and the attribute specified by name does not exist. The default value is false, which causes a run-time exception to be thrown if the attribute does not exist.
name Specifies the name of an entity to insert. The search for the entity is done in the following order : definition, attribute, tile.
page Is a synonym for component.
role Causes the tag to be ignored if the user is not in the specified role.
template Is a synonym for component.
put beanName Specifies the name of the bean whose value is to be used. The bean is retrieved from the specified context, if any. Otherwise, method pageContext.findAttribute is used. If you specify beanProperty, the value is retrieved from the corresponding bean property.
beanProperty Specifies the name of a bean property whose value is to be retrieved. This attribute supports nested and indexed properties.
beanScope Specifies the scope in which the bean is searched for. By default, the method pageContext.findAttribute is used. The scope can be any JSP scope, component, or template. In the latter two cases, the bean is searched for in the tile context.
content Is a synonym for value.
direct Specifies how content is handled: true means that content is contained in the file; false, the default, means that content is included from elsewhere. This is another way to specify content type. If you specify true, the content is interpreted as a string; otherwise, the content is interpreted as a page. This attribute exists for compatibility with the JSP template.
name Specifies the name of the attribute that is being put.
role Causes the tag to be ignored if the user is not in the specified role.
type Specifies one of the following content types:

definition

Specifies a definition that is defined in factory (XML file). The definition will be searched in the inserted tile, in an <insert attribute="attributeName"> tag, where attributeName is the name used for this tag.

page

Includes content from a specified URL. A synonym for this attribute is template.

string

Provides content directly.
If you omit the type attribute, the content is untyped unless it comes from a typed bean.
value Specifies an attribute value that is a string or an object. You must specify value, content, or beanName.
putList name Specifies the name of the list.
useAttribute classname Specifies the class of the declared variable.
id Specifies the declared attribute and variable name.
ignore Returns without error if the value of this attribute is true and the attribute specified by name does not exist. The default value is false, which causes a run-time exception to be thrown if the attribute does not exist.
name Specifies a tile's attribute name.
scope Specifies the scope of the declared attribute. The default is page.

 

Related tasks

Adding Struts tags to a JSP file

Related reference
Properties for Struts bean tags
Properties for Struts HTML tags
Properties for Struts logic tags
Properties for Struts nested tags
Properties for Struts tags

Feedback