Attributes for Struts bean tags
This reference material describes the attributes for the Struts bean tag library. By default, each element name has a bean: prefix.
For more information about the Struts tags and tag attributes, refer to the Apache Struts specifications.
Each Struts tag has a number of attributes that you can set by using the Properties view of the tag. Use this table of attributes while working with the Properties view of the tag, to look up attributes for which you want additional detail. Some attributes have the same name but different usage in different elements. The attributes are listed in alphabetical order.
- <bean:cookie />
- <bean:define />
- <bean:header />
- <bean:include />
- <bean:message />
- <bean:page />
- <bean:parameter />
- <bean:resource/>
- <bean:size/>
- <bean:struts/>
- <bean:write/>
Cookie
Table 1. Cookie tag attributes Attribute Description id Specifies the name of the scripting variable (and associated page scope attribute) that will be made available with the value of the specified property.
Note: This is a required attribute.
multiple If any arbitrary value for this attribute is specified, causes all matching cookies to be accumulated and stored into a bean of type Cookie[]. If not specified, the first value for the specified cookie will be retrieved as a value of type Cookie. name Specifies the name of the request cookie whose value, or values, is to be retrieved.
Note: This is a required attribute.
value The default cookie value to return if no cookie with the specified name was included in this request. Return to the top of the page.
Define
Return to the top of the page.
Header
Table 3. Header tag attributes Properties Description id Specifies the name of the scripting variable (and associated page scope attribute) that will be made available with the value of the specified property.
Note: This is a required attribute.
multiple If any arbitrary value for this attribute is specified, causes a call to HttpServletRequest.getHeaders() and a definition of the result as a bean of type String[]. Otherwise, HttpServletRequest.getHeader() will be called, and a definition of the result as a bean of type String will be performed. name Specifies the name of the request header whose value, or values, is to be retrieved. value Specifies the java.lang.String value to which the exposed bean should be set. This attribute is required unless you specify the
name attribute or nested body content.
Note: This is a required attribute.
Return to the top of the page.
Include
Table 4. Include tag attributes Attribute Description anchor Specifies the optional anchor tag added to the generated hyperlink. forward Logical name of a global ActionForward that contains the actual content relative URI of the resource to be included. href Absolute URL of the resource to be included. id Specifies the name of the scripting variable and associated page scope attribute that is available with the value of the specified web application resource.
Note: This is a required attribute.
page Module relative URI of the Web application resource to be included. transaction Set to true if you want the current transaction control token included in the generated URL for this include. Return to the top of the page.
Message
Return to the top of the page.
Page
Table 6. Page tag attributes Attribute Description id Specifies the name of the scripting variable (and associated page scope attribute) that will be made available with the value of the specified page context property.
Note: This is a required attribute.
property Name of the property from our page context to be retrieved and exposed. Must be one of application, config, request, response, or session.
Note: This is a required attribute.
Return to the top of the page.
Parameter
Table 7. Parameter tag attributes Attribute Description id Specifies the name of the scripting variable (and associated page scope attribute) that will be made available with the value of the specified request parameter.
Note: This is a required attribute.
multiple If any arbitrary value for this attribute is specified, causes a call to ServletRequest.getParameterValues() and a definition of the result as a bean of type String[]. Otherwise, ServletRequest.getParameter() will be called, and a definition of the result as a bean of type String will be performed. name Specifies the name of the request parameter whose value, or values, is to be retrieved.
Note: This is a required attribute.
value The default parameter value to return if no parameter with the specified name was included in this request. Return to the top of the page.
Resource
Table 8. Resource tag attributes Attribute Description id Specifies the name of the scripting variable (and associated page scope attribute) that will be made available with the value of the specified web application resource.
Note: This is a required attribute.
input If any arbitrary value for this attribute is specified, the resource will be made available as an InputStream. If this attribute is not specified, the resource will be made available as a String. name Module relative name of the Web application resource to be loaded and made available.
Note: This is a required attribute.
Return to the top of the page.
Size
Table 9. Size tag attributes Attribute Description collection A runtime expression that evaluates to an array, a Collection, or a Map. id The name of a page scope JSP bean, of type java.lang.Integer, that will be created to contain the size of the underlying collection being counted.
Note: This is a required attribute.
name The name of the JSP bean (optionally constrained to the scope specified by the scope attribute) that contains the collection to be counted (if property is not specified), or whose property getter is called to return the collection to be counted (if property is specified. property The name of the property, of the bean specified by the name attribute, whose getter method will return the collection to be counted. scope The bean scope within which to search for the JSP bean specified by the name attribute. If not specified, the available scopes are searched in ascending sequence. Return to the top of the page.
Struts
Table 10. Struts tag attributes Attribute Description formBean Specifies the name of the Struts ActionFormBean definition object to be exposed. forward Specifies the name of the global Struts ActionForward definition object to be exposed. id Specifies the name of the scripting variable (and associated page scope attribute) that will be made available with the value of the specified Struts internal configuration object.
Note: This is a required attribute.
mapping Specifies the matching path of the Struts ActionMapping definition object to be exposed. Return to the top of the page.
Write
Table 11. Write tag attributes Attribute Description bundle Specifies the name of the application scope bean under which the MessageResources object that contains messages is stored. The default is Globals.MESSAGES_KEY. filter If set to false, suppresses filtering of the rendered property value for characters that are sensitive in HTML. By default, such values are converted to their entity equivalents.
format Specifies the format string to use to convert a bean or property value to the String object. By default, the format string for
value data type will be searched in message resources according to key.
formatKey Specifies the key to be used to search a format string in application resources. ignore If set to true and the bean specified by the
name and
scope properties does not exist, returns without writing anything. If set to
false and the bean does not exist, throws a runtime exception.
locale Specifies the name of the session scope bean under which our currently selected Locale object is stored. The default is Globals.LOCALE_KEY. name Specifies the attribute name of the bean whose property is accessed to retrieve the value specified by property (if specified). If property is not specified, the value of this bean itself will be rendered.
Note: This is a required attribute.
property Specifies the name of the property to be accessed on the bean specified by
name. This value can be a simple, indexed, or nested property reference expression. By default, the bean identified by
name will itself be rendered. If the specified property returns null, no output will be rendered.
scope Specifies the variable scope that to be searched to retrieve the bean specified by name. By default, the default rules applied by
PageContext.findAttribute() are applied.
Return to the top of the page.