The Struts Framework Project - HTML Tags

The Jakarta Project
Page Construction Tags

This taglib contains tags used to create struts input forms, as well as other tags generally useful in the creation of HTML-based user interfaces.

Many of the tags in this tag library will throw a JspException at runtime when they are utilized incorrectly (such as when you specify an invalid combination of tag attributes). JSP allows you to declare an "error page" in the <%@ page %> directive. If you wish to process the actual exception that caused the problem, it is passed to the error page as a request attribute under key org.apache.struts.action.EXCEPTION.

Tag Name | Description
base | Render an HTML <base> Element
button | Render A Button Input Field
cancel | Render a Cancel Button
checkbox | Render A Checkbox Input Field
errors | Conditionally display a set of accumulated error messages.
file | Render A File Select Input Field
form | Define An Input Form
frame | Render an HTML frame element
hidden | Render A Hidden Field
html | Render an HTML <html> Element
image | Render an input tag of type "image"
img | Render an HTML img tag
javascript | Render JavaScript validation based on the validation rules loaded by the ValidatorPlugIn.
link | Render an HTML anchor or hyperlink
messages | Conditionally display a set of accumulated messages.
multibox | Render A Checkbox Input Field
option | Render A Select Option
options | Render a Collection of Select Options
optionsCollection | Render a Collection of Select Options
password | Render A Password Input Field
radio | Render A Radio Button Input Field
reset | Render A Reset Button Input Field
rewrite | Render an URI
select | Render A Select Element
submit | Render A Submit Button
text | Render An Input Field of Type text
textarea | Render A Textarea
xhtml | Render HTML tags as XHTML
Copyright (c) 2000-2003, Apache Software Foundation - Comments?
Powered by Struts


The Struts Framework Project - HTML Tags

base - Render an HTML <base> Element

Renders an HTML <base> element with an href attribute pointing to the absolute location of the enclosing JSP page. This tag is valid only when nested inside an HTML <head> element.

This tag is useful because it allows you to use relative URL references in the page that are calculated based on the URL of the page itself, rather than the URL to which the most recent submit took place (which is where the browser would normally resolve relative references against).

Attribute Name Description
server

The server name to use instead of request.getServerName().

(RT EXPR)
target

The window target for this base reference.

(RT EXPR)


The Struts Framework Project - HTML Tags

button - Render A Button Input Field

Renders an HTML <input> element of type button, populated from the specified value or the content of this tag body. This tag is only valid when nested inside a form tag body.

If a graphical button is needed (a button with an image), then the image tag is more appropriate.

Attribute Name | Description
accesskey | The keyboard character used to move focus immediately to this element. (RT EXPR)
alt

The alternate text for this element.

(RT EXPR)
altKey

The message resources key of the alternate text for this element.

(RT EXPR)
disabled | Set to true if this input field should be disabled. (RT EXPR)
indexed | Valid only inside of logic:iterate tag. If true then name of the html tag will be rendered as "propertyName[34]". Number in brackets will be generated for every iteration and taken from ancestor logic:iterate tag. (RT EXPR)
onblur | JavaScript event handler executed when this element loses input focus. (RT EXPR)
onchange | JavaScript event handler executed when this element loses input focus and its value has changed. (RT EXPR)
onclick | JavaScript event handler executed when this element receives a mouse click. (RT EXPR)
ondblclick | JavaScript event handler executed when this element receives a mouse double click. (RT EXPR)
onfocus | JavaScript event handler executed when this element receives input focus. (RT EXPR)
onkeydown | JavaScript event handler executed when this element has focus and a key is depressed. (RT EXPR)
onkeypress | JavaScript event handler executed when this element has focus and a key is depressed and released. (RT EXPR)
onkeyup | JavaScript event handler executed when this element has focus and a key is released. (RT EXPR)
onmousedown | JavaScript event handler executed when this element is under the mouse pointer and a mouse button is depressed. (RT EXPR)
onmousemove | JavaScript event handler executed when this element is under the mouse pointer and the pointer is moved. (RT EXPR)
onmouseout | JavaScript event handler executed when this element was under the mouse pointer but the pointer was moved outside the element. (RT EXPR)
onmouseover | JavaScript event handler executed when this element was not under the mouse pointer but the pointer is moved inside the element. (RT EXPR)
onmouseup | JavaScript event handler executed when this element is under the mouse pointer and a mouse button is released. (RT EXPR)
property | Name of the request parameter that will be included with this submission, set to the specified value. (REQUIRED) (RT EXPR)
style | CSS styles to be applied to this HTML element. (RT EXPR)
styleClass | CSS stylesheet class to be applied to this HTML element (renders a "class" attribute). (RT EXPR)
styleId | Identifier to be assigned to this HTML element (renders an "id" attribute). (RT EXPR)
tabindex | The tab order (ascending positive integers) for this element. (RT EXPR)
title

The advisory title for this element.

(RT EXPR)
titleKey

The message resources key for the advisory title for this element.

(RT EXPR)
value | Value of the label to be placed on this button. This value will also be submitted as the value of the specified request parameter. [Body of this tag (if any), or "Click"] (RT EXPR)


The Struts Framework Project - HTML Tags

cancel - Render a Cancel Button

Renders an HTML <input> element of type submit. This tag is only valid when nested inside a form tag body. Pressing of this submit button causes the action servlet to bypass calling the associated form bean validate() method. The action is called normally.

Attribute Name | Description
accesskey | The keyboard character used to move focus immediately to this element. (RT EXPR)
alt

The alternate text for this element.

(RT EXPR)
altKey

The message resources key of the alternate text for this element.

(RT EXPR)
disabled | Set to true if this input field should be disabled. (RT EXPR)
onblur | JavaScript event handler executed when this element loses input focus. (RT EXPR)
onchange | JavaScript event handler executed when this element loses input focus and its value has changed. (RT EXPR)
onclick | JavaScript event handler executed when this element receives a mouse click. (RT EXPR)
ondblclick | JavaScript event handler executed when this element receives a mouse double click. (RT EXPR)
onfocus | JavaScript event handler executed when this element receives input focus. (RT EXPR)
onkeydown | JavaScript event handler executed when this element has focus and a key is depressed. (RT EXPR)
onkeypress | JavaScript event handler executed when this element has focus and a key is depressed and released. (RT EXPR)
onkeyup | JavaScript event handler executed when this element has focus and a key is released. (RT EXPR)
onmousedown | JavaScript event handler executed when this element is under the mouse pointer and a mouse button is depressed. (RT EXPR)
onmousemove | JavaScript event handler executed when this element is under the mouse pointer and the pointer is moved. (RT EXPR)
onmouseout | JavaScript event handler executed when this element was under the mouse pointer but the pointer was moved outside the element. (RT EXPR)
onmouseover | JavaScript event handler executed when this element was not under the mouse pointer but the pointer is moved inside the element. (RT EXPR)
onmouseup | JavaScript event handler executed when this element is under the mouse pointer and a mouse button is released. (RT EXPR)
property | Name of the request parameter that will be included with this submission, set to the specified value. WARNING - If you set this attribute to a value other than the default, this will NOT be recognized as the cancel key by the Struts controller servlet or the Action.isCancelled() method. You will need to do your own cancel detection. (RT EXPR)
style | CSS styles to be applied to this HTML element. (RT EXPR)
styleClass | CSS stylesheet class to be applied to this HTML element (renders a "class" attribute). (RT EXPR)
styleId | Identifier to be assigned to this HTML element (renders an "id" attribute). (RT EXPR)
tabindex | The tab order (ascending positive integers) for this element. (RT EXPR)
title

The advisory title for this element.

(RT EXPR)
titleKey

The message resources key for the advisory title for this element.

(RT EXPR)
value | Value of the label to be placed on this button. This value will also be submitted as the value of the specified request parameter. [Body of this tag (if any), or "Cancel"] (RT EXPR)


The Struts Framework Project - HTML Tags

checkbox - Render A Checkbox Input Field

Renders an HTML <input> element of type checkbox, populated from the specified value or the specified property of the bean associated with our current form. This tag is only valid when nested inside a form tag body.

NOTE: The underlying property value associated with this field should be of type boolean, and any value you specify should correspond to one of the Strings that indicate a true value ("true", "yes", or "on"). If you wish to utilize a set of related String values, consider using the multibox tag.

WARNING: In order to correctly recognize unchecked checkboxes, the ActionForm bean associated with this form must include a statement setting the corresponding boolean property to false in the reset() method.
Attribute Name | Description
accesskey | The keyboard character used to move focus immediately to this element. (RT EXPR)
alt

The alternate text for this element.

(RT EXPR)
altKey

The message resources key of the alternate text for this element.

(RT EXPR)
disabled | Set to true if this input field should be disabled. (RT EXPR)
indexed | Valid only inside of logic:iterate tag. If true then name of the html tag will be rendered as "id[34].propertyName". Number in brackets will be generated for every iteration and taken from ancestor logic:iterate tag. (RT EXPR)
name | The attribute name of the bean whose properties are consulted when rendering the current value of this input field. If not specified, the bean associated with the form tag we are nested within is utilized. (RT EXPR)
onblur | JavaScript event handler executed when this element loses input focus. (RT EXPR)
onchange | JavaScript event handler executed when this element loses input focus and its value has changed. (RT EXPR)
onclick | JavaScript event handler executed when this element receives a mouse click. (RT EXPR)
ondblclick | JavaScript event handler executed when this element receives a mouse double click. (RT EXPR)
onfocus | JavaScript event handler executed when this element receives input focus. (RT EXPR)
onkeydown | JavaScript event handler executed when this element has focus and a key is depressed. (RT EXPR)
onkeypress | JavaScript event handler executed when this element has focus and a key is depressed and released. (RT EXPR)
onkeyup | JavaScript event handler executed when this element has focus and a key is released. (RT EXPR)
onmousedown | JavaScript event handler executed when this element is under the mouse pointer and a mouse button is depressed. (RT EXPR)
onmousemove | JavaScript event handler executed when this element is under the mouse pointer and the pointer is moved. (RT EXPR)
onmouseout | JavaScript event handler executed when this element was under the mouse pointer but the pointer was moved outside the element. (RT EXPR)
onmouseover | JavaScript event handler executed when this element was not under the mouse pointer but the pointer is moved inside the element. (RT EXPR)
onmouseup | JavaScript event handler executed when this element is under the mouse pointer and a mouse button is released. (RT EXPR)
property | Name of the request parameter that will be included with this submission, set to the specified value. (REQUIRED) (RT EXPR)
style | CSS styles to be applied to this HTML element. (RT EXPR)
styleClass | CSS stylesheet class to be applied to this HTML element (renders a "class" attribute). (RT EXPR)
styleId | Identifier to be assigned to this HTML element (renders an "id" attribute). (RT EXPR)
tabindex | The tab order (ascending positive integers) for this element. (RT EXPR)
title

The advisory title for this element.

(RT EXPR)
titleKey

The message resources key for the advisory title for this element.

(RT EXPR)
value | The value to be transmitted if this checkbox is checked when the form is submitted. If not specified, the value "on" will be returned. (RT EXPR)


The Struts Framework Project - HTML Tags

errors - Conditionally display a set of accumulated error messages.

Displays a set of error messages prepared by a business logic component and stored as an ActionErrors object, a String, or a String array in request scope. If such a bean is not found, nothing will be rendered.

In order to use this tag successfully, you must have defined an application scope MessageResources bean under the default attribute name, with optional definitions of the following message keys:

  • errors.header - Text that will be rendered before the error messages list. Typically, this message text will end with <ul> to start the error messages list.
  • errors.footer - Text that will be rendered after the error messages list. Typically, this message text will begin with </ul> to end the error messages list.
  • errors.prefix - Text that will be rendered before each individual error in the list.
  • errors.suffix - Text that will be rendered after each individual error in the list.
Attribute Name | Description
bundle | The servlet context attribute key for the MessageResources instance to use. If not specified, defaults to the application resources configured for our action servlet. (RT EXPR)
locale | The session attribute key for the Locale used to select messages to be displayed. If not specified, defaults to the Struts standard value. (RT EXPR)
name | Name of the request scope bean under which our error messages have been stored. If not present, the name specified by the Action.ERROR_KEY constant string will be used. (RT EXPR)
property | Name of the property for which error messages should be displayed. If not specified, all error messages (regardless of property) are displayed. (RT EXPR)


The Struts Framework Project - HTML Tags

file - Render A File Select Input Field

Renders an HTML <input> element of type file, defaulting to the specified value or the specified property of the bean associated with our current form. This tag is only valid when nested inside a form tag body.

As with the corresponding HTML <input> element, the enclosing form element must specify "POST" for the method attribute, and "multipart/form-data" for the enctype attribute. For example:

    <html:form method="POST" enctype="multipart/form-data">
        <html:file property="theFile" />
    </html:form>
Attribute Name | Description
accept | Comma-delimited set of content types that the server you submit to knows how to process. This list can be used by the client browser to limit the set of file options that is made available for selection. If not specified, no content type list will be sent. (RT EXPR)
accesskey | The keyboard character used to move focus immediately to this element. (RT EXPR)
alt

The alternate text for this element.

(RT EXPR)
altKey

The message resources key of the alternate text for this element.

(RT EXPR)
disabled | Set to true if this input field should be disabled. (RT EXPR)
indexed | Valid only inside of logic:iterate tag. If true then name of the html tag will be rendered as "id[34].propertyName". Number in brackets will be generated for every iteration and taken from ancestor logic:iterate tag. (RT EXPR)
maxlength | Maximum number of input characters to accept. This is ignored by most browsers. [No limit] (RT EXPR)
name | The attribute name of the bean whose properties are consulted when rendering the current value of this input field. If not specified, the bean associated with the form tag we are nested within is utilized. (RT EXPR)
onblur | JavaScript event handler executed when this element loses input focus. (RT EXPR)
onchange | JavaScript event handler executed when this element loses input focus and its value has changed. (RT EXPR)
onclick | JavaScript event handler executed when this element receives a mouse click. (RT EXPR)
ondblclick | JavaScript event handler executed when this element receives a mouse double click. (RT EXPR)
onfocus | JavaScript event handler executed when this element receives input focus. (RT EXPR)
onkeydown | JavaScript event handler executed when this element has focus and a key is depressed. (RT EXPR)
onkeypress | JavaScript event handler executed when this element has focus and a key is depressed and released. (RT EXPR)
onkeyup | JavaScript event handler executed when this element has focus and a key is released. (RT EXPR)
onmousedown | JavaScript event handler executed when this element is under the mouse pointer and a mouse button is depressed. (RT EXPR)
onmousemove | JavaScript event handler executed when this element is under the mouse pointer and the pointer is moved. (RT EXPR)
onmouseout | JavaScript event handler executed when this element was under the mouse pointer but the pointer was moved outside the element. (RT EXPR)
onmouseover | JavaScript event handler executed when this element was not under the mouse pointer but the pointer is moved inside the element. (RT EXPR)
onmouseup | JavaScript event handler executed when this element is under the mouse pointer and a mouse button is released. (RT EXPR)
property | Name of the request parameter that will be included with this submission, set to the specified value. (REQUIRED) (RT EXPR)
size | Size of the file selection box to be displayed. (RT EXPR)
style | CSS styles to be applied to this HTML element. (RT EXPR)
styleClass | CSS stylesheet class to be applied to this HTML element (renders a "class" attribute). (RT EXPR)
styleId | Identifier to be assigned to this HTML element (renders an "id" attribute). (RT EXPR)
tabindex | The tab order (ascending positive integers) for this element. (RT EXPR)
title

The advisory title for this element.

(RT EXPR)
titleKey

The message resources key for the advisory title for this element.

(RT EXPR)
value

NOTE: When setting this to some value, whether intentional or as the result (for example) of validation errors forcing the user back to the original jsp, this value is ignored by most browsers (for security reasons). This means that your users will have to re-select any previously selected files when submitting the form. Opera web browser will prompt the user so they have a chance to abort the submit.

Value to which this field should be initialized. [Use the corresponding bean property value or body content (if any) if property is not specified] (RT EXPR)


The Struts Framework Project - HTML Tags

form - Define An Input Form

Renders an HTML <form> element whose contents are described by the body content of this tag. The form implicitly interacts with the specified request scope or session scope bean to populate the input fields with the current property values from the bean.

The form bean is located, and created if necessary, based on the form bean specification for the associated ActionMapping.

Attribute Name | Description
action

The URL to which this form will be submitted. This value is also used to select the ActionMapping we are assumed to be processing, from which we can identify the appropriate form bean and scope.

If you are using extension mapping for selecting the controller servlet, this value should be equal to the path attribute of the corresponding <action> element, optionally followed by the correct extension suffix.

If you are using path mapping to select the controller servlet, this value should be exactly equal to the path attribute of the corresponding <action> element.

(REQUIRED) (RT EXPR)
enctype | The content encoding to be used to submit this form, if the method is POST. This must be set to "multipart/form-data" if you are using the file tag to enable file upload. If not specified, the browser default (normally "application/x-www-form-urlencoded") is used. (RT EXPR)
focus | The field name (among the fields on this form) to which initial focus will be assigned with a JavaScript function. If not specified, no special JavaScript for this purpose will be rendered. (RT EXPR)
focusIndex

Since: Struts 1.1

If the focus field is a field array, such as a radio button group, you can specify the index in the array to receive focus. (RT EXPR)
method | The HTTP method that will be used to submit this request (GET, POST). [POST] (RT EXPR)
onreset | JavaScript event handler executed if the form is reset. (RT EXPR)
onsubmit | JavaScript event handler executed if the form is submitted. (RT EXPR)
scriptLanguage

Since: Struts 1.2

The form's focus <script> element will not contain a language attribute when this is set to false. The default is true but this property is ignored in XHMTL mode. (RT EXPR)
style | CSS styles to be applied to this HTML element. (RT EXPR)
styleClass | CSS stylesheet class to be applied to this HTML element (renders a "class" attribute). (RT EXPR)
styleId | Identifier to be assigned to this HTML element (renders an "id" attribute). (RT EXPR)
target | Window target to which this form is submitted, such as for use in framed presentations. (RT EXPR)


The Struts Framework Project - HTML Tags

frame - Render an HTML frame element

Renders an HTML <frame> element with processing for the src attribute that is identical to that performed by the <html:link> tag for the href attribute. URL rewriting will be applied automatically, to maintain session state in the absence of cookies.

The base URL for this frame is calculated based on which of the following attributes you specify (you must specify exactly one of them):

  • forward - Use the value of this attribute as the name of a global ActionForward to be looked up, and use the application-relative or context-relative URI found there.
  • href - Use the value of this attribute unchanged.
  • page - Use the value of this attribute as a application-relative URI, and generate a server-relative URI by including the context path and application prefix.
  • action - Use the value of this attribute as the logical name of a global Action that contains the actual content-relative URI of the destination of this transfer.

Normally, the hyperlink you specify with one of the attributes described in the previous paragraph will be left unchanged (other than URL rewriting if necessary). However, there are two ways you can append one or more dynamically defined query parameters to the hyperlink -- specify a single parameter with the paramId attribute (and its associated attributes to select the value), or specify the name (and optional property) attributes to select a java.util.Map bean that contains one or more parameter ids and corresponding values.

To specify a single parameter, use the paramId attribute to define the name of the request parameter to be submitted. To specify the corresponding value, use one of the following approaches:

  • Specify only the paramName attribute - The named JSP bean (optionally scoped by the value of the paramScope attribute) must identify a value that can be converted to a String.
  • Specify both the paramName and paramProperty attributes - The specified property getter method will be called on the JSP bean identified by the paramName (and optional paramScope) attributes, in order to select a value that can be converted to a String.

If you prefer to specify a java.util.Map that contains all of the request parameters to be added to the hyperlink, use one of the following techniques:

  • Specify only the name attribute - The named JSP bean (optionally scoped by the value of the scope attribute) must identify a java.util.Map containing the parameters.
  • Specify both name and property attributes - The specified property getter method will be called on the bean identified by the name (and optional scope) attributes, in order to return the java.util.Map containing the parameters.

As the Map is processed, the keys are assumed to be the names of query parameters to be appended to the hyperlink. The value associated with each key must be either a String or a String array representing the parameter value(s), or an object whose toString() method will be called. If a String array is specified, more than one value for the same query parameter name will be created.

Additionally, you can request that the current transaction control token, if any, be included in the generated hyperlink by setting the transaction attribute to true. You can also request that an anchor ("#xxx") be added to the end of the URL that is created by any of the above mechanisms, by using the anchor attribute.
Attribute Name | Description
action

Logical name of a global Action that contains the actual content-relative URI of the destination of this transfer. This hyperlink may be dynamically modified by the inclusion of query parameters, as described in the tag description. You must specify exactly one of the action attribute, the forward attribute, the href attribute, or the page attribute.

(RT EXPR)
anchor

Optional anchor tag ("#xxx") to be added to the generated hyperlink. Specify this value without any "#" character.

(RT EXPR)
forward

Logical name of a global ActionForward that contains the actual content-relative URI of the destination of this transfer. This hyperlink may be dynamically modified by the inclusion of query parameters, as described in the tag description. You must specify exactly one of the action attribute, the forward attribute, the href attribute, or the page attribute.

(RT EXPR)
frameborder

Should a frame border be generated around this frame (1) or not (0)?

(RT EXPR)
frameName

Value for the name attribute of the rendered <frame> element.

(RT EXPR)
href

The URL to which this hyperlink will transfer control if activated. This hyperlink may be dynamically modified by the inclusion of query parameters, as described in the tag description. You must specify exactly one of the action attribute, the forward attribute, the href attribute, or the page attribute.

(RT EXPR)
longdesc

URI of a long description of the frame. This description should supplement the short description provided by the title attribute, and may be particularly useful for non-visual user agents.

(RT EXPR)
marginheight

The amount of space (in pixels) to be left between the frame's contents and its top and bottom margins.

(RT EXPR)
marginwidth

The amount of space (in pixels) to be left between the frame's contents and its left and right margins.

(RT EXPR)
name

The name of a JSP bean that contains a Map representing the query parameters (if property is not specified), or a JSP bean whose property getter is called to return a Map (if property is specified).

(RT EXPR)
noresize

Should users be disallowed from resizing the frame? (true, false).

(RT EXPR)
page

The module-relative path (beginning with a "/" character) to which this hyperlink will transfer control if activated. This hyperlink may be dynamically modified by the inclusion of query parameters, as described in the tag description. You must specify exactly one of the action attribute, the forward attribute, the href attribute, or the page attribute.

(RT EXPR)
paramId

The name of the request parameter that will be dynamically added to the generated hyperlink. The corresponding value is defined by the paramName and (optional) paramProperty attributes, optionally scoped by the paramScope attribute

(RT EXPR)
paramName

The name of a JSP bean that is a String containing the value for the request parameter named by paramId (if paramProperty is not specified), or a JSP bean whose property getter is called to return a String (if paramProperty is specified). The JSP bean is constrained to the bean scope specified by the paramScope property, if it is specified.

(RT EXPR)
paramProperty

The name of a property of the bean specified by the paramName attribute, whose return value must be a String containing the value of the request parameter (named by the paramId attribute) that will be dynamically added to this hyperlink.

(RT EXPR)
paramScope

The scope within which to search for the bean specified by the paramName attribute. If not specified, all scopes are searched.

(RT EXPR)
property

The name of a property of the bean specified by the name attribute, whose return value must be a java.util.Map containing the query parameters to be added to the hyperlink. You must specify the name attribute if you specify this attribute.

(RT EXPR)
scope

The scope within which to search for the bean specified by the name attribute. If not specified, all scopes are searched.

(RT EXPR)
scrolling

Should scroll bars be created unconditionally (yes), never (no), or only when needed (auto)?

(RT EXPR)
style

CSS styles to be applied to this element.

(RT EXPR)
styleClass | CSS stylesheet class to be applied to this HTML element (renders a "class" attribute). (RT EXPR)
styleId | Identifier to be assigned to this HTML element (renders an "id" attribute). (RT EXPR)
title

The advisory title for this element.

(RT EXPR)
titleKey

The message resources key for the advisory title for this element.

(RT EXPR)
transaction

If set to true, any current transaction control token will be included in the generated hyperlink, so that it will pass an isTokenValid() test in the receiving Action.

(RT EXPR)


The Struts Framework Project - HTML Tags

messages - Conditionally display a set of accumulated messages.

Displays a set of messages prepared by a business logic component and stored as an ActionMessages object, ActionErrors object, a String, or a String array in any scope. If such a bean is not found, nothing will be rendered.

In order to use this tag successfully, you must have defined an application scope MessageResources bean under the default attribute name.
Attribute Name | Description
bundle | The servlet context attribute key for the MessageResources instance to use. If not specified, defaults to the application resources configured for our action servlet. (RT EXPR)
footer | This value is an optional message resource key that will be printed after the iteration of messages has finished. (RT EXPR)
header | This value is an optional message resource key that will be printed before the iteration of messages begins. (RT EXPR)
id | The name of a page scope JSP bean that will contain the current element of the collection of messages on each iteration, if it is not null. (REQUIRED)
locale | The session attribute key for the Locale used to select messages to be displayed. If not specified, defaults to the Struts standard value. (RT EXPR)
message | By default the tag will retrieve the bean it will iterate over from the Action.ERROR_KEY constant string, but if this attribute is set to 'true' the bean will be retrieved from the Action.MESSAGE_KEY constant string. Also if this is set to 'true', any value assigned to the name attribute will be ignored. (RT EXPR)
name | Name of the bean in any scope under which our messages have been stored. If not present, the name specified by the Action.ERROR_KEY constant string will be used. (RT EXPR)
property | Name of the property for which messages should be displayed. If not specified, all messages (regardless of property) are displayed. (RT EXPR)


The Struts Framework Project - HTML Tags

hidden - Render A Hidden Field

Renders an HTML <input> element of type hidden, populated from the specified value or the specified property of the bean associated with our current form. This tag is only valid when nested inside a form tag body.

Attribute Name | Description
accesskey | The keyboard character used to move focus immediately to this element. (RT EXPR)
alt

The alternate text for this element.

(RT EXPR)
altKey

The message resources key of the alternate text for this element.

(RT EXPR)
indexed | Valid only inside of logic:iterate tag. If true then name of the html tag will be rendered as "id[34].propertyName". Number in brackets will be generated for every iteration and taken from ancestor logic:iterate tag. (RT EXPR)
name | The attribute name of the bean whose properties are consulted when rendering the current value of this input field. If not specified, the bean associated with the form tag we are nested within is utilized. (RT EXPR)
onblur | JavaScript event handler executed when this element loses input focus. (RT EXPR)
onchange | JavaScript event handler executed when this element loses input focus and its value has changed. (RT EXPR)
onclick | JavaScript event handler executed when this element receives a mouse click. (RT EXPR)
ondblclick | JavaScript event handler executed when this element receives a mouse double click. (RT EXPR)
onfocus | JavaScript event handler executed when this element receives input focus. (RT EXPR)
onkeydown | JavaScript event handler executed when this element has focus and a key is depressed. (RT EXPR)
onkeypress | JavaScript event handler executed when this element has focus and a key is depressed and released. (RT EXPR)
onkeyup | JavaScript event handler executed when this element has focus and a key is released. (RT EXPR)
onmousedown | JavaScript event handler executed when this element is under the mouse pointer and a mouse button is depressed. (RT EXPR)
onmousemove | JavaScript event handler executed when this element is under the mouse pointer and the pointer is moved. (RT EXPR)
onmouseout | JavaScript event handler executed when this element was under the mouse pointer but the pointer was moved outside the element. (RT EXPR)
onmouseover | JavaScript event handler executed when this element was not under the mouse pointer but the pointer is moved inside the element. (RT EXPR)
onmouseup | JavaScript event handler executed when this element is under the mouse pointer and a mouse button is released. (RT EXPR)
property | Name of this input field, and the name of the corresponding bean property if value is not specified. The corresponding bean property (if any) must be of type String. (REQUIRED) (RT EXPR)
style | CSS styles to be applied to this HTML element. (RT EXPR)
styleClass | CSS stylesheet class to be applied to this HTML element (renders a "class" attribute). (RT EXPR)
styleId | Identifier to be assigned to this HTML element (renders an "id" attribute). (RT EXPR)
title

The advisory title for this element.

(RT EXPR)
titleKey

The message resources key for the advisory title for this element.

(RT EXPR)
value | Value to which this field should be initialized. [Use the corresponding bean property value] (RT EXPR)
write | Should the value of this field also be rendered to the response page to make it visible, in addition to creating an HTML type="hidden" element? By default, only the hidden element is created. (RT EXPR)


The Struts Framework Project - HTML Tags

html - Render an HTML <html> Element

Renders an HTML <html> element with language attributes extracted from the user's current Locale object, if there is one.
Attribute Name Description
lang

Since: Struts 1.2

Renders a lang attribute with the locale stored in the user's session. If not found in the session, the language from the Accept-Language HTTP header is used. If still not found, the default language for the server is used. (RT EXPR)
locale

DEPRECATED: Creating a session is undesirable for apps that don't support them. Use the lang attribute to acheive the same functionality without creating a session.

Set to true in order to store a Locale in the session based on the current request's Accept-Language header (if any) if none has currently been set. This attribute will create a session if one does not already exist. The lang attribute is rendered with the appropriate language code.

(RT EXPR)
xhtml

Since: Struts 1.1

Set to true in order to render xml:lang and xmlns attributes on the generated html element. This also causes all other html tags to render as xhtml.

(RT EXPR)


The Struts Framework Project - HTML Tags

image - Render an input tag of type "image"

Renders an HTML <input> tag of type "image". The base URL for this image is calculated directly based on the value specified in the src or page attributes, or indirectly by looking up a message resource string based on the srcKey or pageKey attributes. You must specify exactly one of these attributes.

If you would like to obtain the coordinates of the mouse click that submitted this request, see the information below on the property attribute.

This tag is only valid when nested inside a form tag body.
Attribute Name | Description
accesskey

The keyboard character used to move focus immediately to this element.

(RT EXPR)
align

The alignment option for this image.

The alignment option for this image. The align attribute is deprecated in HTML 4.x. The suggested alternative is to use CSS. Please see http://www.w3.org/TR/REC-html40/struct/objects.html#h-13.7.4 for more details.

(RT EXPR)
alt

The alternate text for this image.

(RT EXPR)
altKey

The message resources key of the alternate text for this image.

(RT EXPR)
border

The width (in pixels) of the border around this image.

(RT EXPR)
bundle

The servlet context attribute key for the MessageResources instance to use. If not specified, defaults to the application resources configured for our action servlet.

(RT EXPR)
disabled | Set to true if this input field should be disabled. (RT EXPR)
indexed | Valid only inside of logic:iterate tag. If true then name of the html tag will be rendered as "propertyName[34]". Number in brackets will be generated for every iteration and taken from ancestor logic:iterate tag. (RT EXPR)
locale

The session attribute key for the Locale used to select internationalized messages. If not specified, defaults to the Struts standard value.

(RT EXPR)
onblur | JavaScript event handler executed when this element loses input focus. (RT EXPR)
onchange | JavaScript event handler executed when this element loses input focus and its value has changed. (RT EXPR)
onclick | JavaScript event handler executed when this element receives a mouse click. (RT EXPR)
ondblclick | JavaScript event handler executed when this element receives a mouse double click. (RT EXPR)
onfocus | JavaScript event handler executed when this element receives input focus. (RT EXPR)
onkeydown | JavaScript event handler executed when this element has focus and a key is depressed. (RT EXPR)
onkeypress | JavaScript event handler executed when this element has focus and a key is depressed and released. (RT EXPR)
onkeyup | JavaScript event handler executed when this element has focus and a key is released. (RT EXPR)
onmousedown | JavaScript event handler executed when this element is under the mouse pointer and a mouse button is depressed. (RT EXPR)
onmousemove | JavaScript event handler executed when this element is under the mouse pointer and the pointer is moved. (RT EXPR)
onmouseout | JavaScript event handler executed when this element was under the mouse pointer but the pointer was moved outside the element. (RT EXPR)
onmouseover | JavaScript event handler executed when this element was not under the mouse pointer but the pointer is moved inside the element. (RT EXPR)
onmouseup | JavaScript event handler executed when this element is under the mouse pointer and a mouse button is released. (RT EXPR)
page

The module-relative path of the image for this input tag.

(RT EXPR)
pageKey

The key of the message resources string specifying the module-relative path of the image for this input tag.

(RT EXPR)
property

The property name of this image tag. The parameter names for the request will appear as "property.x" and "property.y", the x and y representing the coordinates of the mouse click for the image. A way of retrieving these values through a form bean is to define getX(), getY(), setX(), and setY() methods, and specify your property as a blank string (property="").

(RT EXPR)
src

The source URL of the image for this input tag.

(RT EXPR)
srcKey

The key of the message resources string specifying the source URL of the image for this input tag.

(RT EXPR)
style | CSS styles to be applied to this HTML element. (RT EXPR)
styleClass | CSS stylesheet class to be applied to this HTML element (renders a "class" attribute). (RT EXPR)
styleId | Identifier to be assigned to this HTML element (renders an "id" attribute). (RT EXPR)
tabindex | The tab order (ascending positive integers) for this element. (RT EXPR)
title

The advisory title for this element.

(RT EXPR)
titleKey

The message resources key for the advisory title for this element.

(RT EXPR)
value

The value that will be submitted if this image button is pressed.

(RT EXPR)


The Struts Framework Project - HTML Tags

img - Render an HTML img tag

Renders an HTML <img> element with the image at the specified URL. Like the link tag, URL rewriting will be applied automatically to the value specified in src or page, to maintain session state in the absence of cookies. This will allow dynamic generation of an image where the content displayed for this image will be taken from the attributes of this tag.

The base URL for this image is calculated directly based on the value specified in src or page, or indirectly by looking up a message resource string based on the srcKey or pageKey attributes. You must specify exactly one of these attributes.

Normally, the src or page that you specify will be left unchanged (other than URL rewriting if necessary). However, there are two ways you can append one or more dynamically defined query parameters to the src URL -- specify a single parameter with the paramId attribute (at its associated attributes to select the value), or specify the name (and optional property) attributes to select a java.util.Map bean that contains one or more parameter ids and corresponding values.

To specify a single parameter, use the paramId attribute to define the name of the request parameter to be submitted. To specify the corresponding value, use one of the following approaches:

  • Specify only the paramName attribute - The named JSP bean (optionally scoped by the value of the paramScope attribute) must identify a value that can be converted to a String.
  • Specify both the paramName and paramProperty attributes - The specified property getter will be called on the JSP bean identified by the paramName (and optional paramScope) attributes, in order to select a value that can be converted to a String.

If you prefer to specify a java.util.Map that contains all of the request parameters to be added to the hyperlink, use one of the following techniques:

  • Specify only the name attribute - The named JSP bean (optionally scoped by the value of the scope attribute) must identify a java.util.Map containing the parameters.
  • Specify both name and property attributes - The specified property getter method will be called on the bean identified by the name (and optional scope) attributes, in order to return the java.util.Map containing the parameters.

As the Map is processed, the keys are assumed to be the names of query parameters to be appended to the src URL. The value associated with each key must be either a String or a String array representing the parameter value(s), or an object whose toString() method will be called. If a String array is specified, more than one value for the same query parameter name will be created.

You can specify the alternate text for this image (which most browsers display as pop-up text block when the user hovers the mouse over this image) either directly, through the alt attribute, or indirectly from a message resources bundle, using the bundle and altKey attributes.
Attribute Name | Description
align

Where the image is aligned to. Can be one of the following attributes:

  • left - left justify, wrapping text on right
  • right -right justify, wrapping test on left
  • top - aligns the image with the top of the text on the same row
  • middle - aligns the image's vertical center with the text base line
  • bottom - aligns the image with the bottom of the text's base line
  • texttop - aligns the image's top with that of the text font on the same line
  • absmiddle - aligns the image's vertical center with the absolute center of the text
  • absbottom - aligns the image with the absolute bottom of the text font on the same row
(RT EXPR)
alt

And alternative text to be displayed in browsers that don't support graphics. Also used often as type of context help over images.

(RT EXPR)
altKey

The message resources key of the alternate text for this element.

(RT EXPR)
border

The width of the border surrounding the image.

(RT EXPR)
bundle

The servlet context attribute key for the MessageResources instance to use. If not specified, defaults to the application resources configured for our action servlet.

(RT EXPR)
height

The height of the image being displayed. This parameter is very nice to specify (along with width) to help the browser render the page faster.

(RT EXPR)
hspace

The amount of horizontal spacing between the icon and the text. The text may be in the same paragraph, or be wrapped around the image.

(RT EXPR)
imageName

The scriptable name to be defined within this page, so that you can reference it with intra-page scripts. In other words, the value specified here will render a "name" element in the generated image tag.

(RT EXPR)
ismap

The name of the server-side map that this image belongs to.

(RT EXPR)
locale

The name of the request or session Locale attribute used to look up internationalized messages.

(RT EXPR)
lowsrc

DEPRECATED - This attribute is not defined in the HTML 4.01 spec and will be removed in a future version of Struts. An image for people with low resolution graphics cards.

(RT EXPR)
name

The name of a JSP bean that contains a Map representing the query parameters (if property is not specified), or a JSP bean whose property getter is called to return a Map (if property is specified).

(RT EXPR)
onclick | JavaScript event handler executed when this element receives a mouse click. (RT EXPR)
ondblclick | JavaScript event handler executed when this element receives a mouse double click. (RT EXPR)
onkeydown

JavaScript event handler that is executed when this element receives a key down event.

(RT EXPR)
onkeypress

JavaScript event handler that is executed when this element receives a key press event.

(RT EXPR)
onkeyup

JavaScript event handler that is executed when this element receives a key up event.

(RT EXPR)
onmousedown | JavaScript event handler executed when this element is under the mouse pointer and a mouse button is depressed. (RT EXPR)
onmousemove | JavaScript event handler executed when this element is under the mouse pointer and the pointer is moved. (RT EXPR)
onmouseout | JavaScript event handler executed when this element was under the mouse pointer but the pointer was moved outside the element. (RT EXPR)
onmouseover | JavaScript event handler executed when this element was not under the mouse pointer but the pointer is moved inside the element. (RT EXPR)
onmouseup | JavaScript event handler executed when this element is under the mouse pointer and a mouse button is released. (RT EXPR)
page

The module-relative path, starting with a slash, of the image to be displayed by this tag. The rendered URL for this image will automatically prepend the context path of this web application (in the same manner as the page attribute on the link tag works), in addition to any necessary URL rewriting. You must specify either the page attribute or the src attribute.

(RT EXPR)
pageKey

The message key, in the message resources bundle named by the bundle attribute, of the String to be used as the module-relative path for this image.

(RT EXPR)
paramId

The name of the request parameter that will be dynamically added to the generated src URL. The corresponding value is defined by the paramName and (optional) paramProperty attributes, optionally scoped by the paramScope attribute

(RT EXPR)
paramName

The name of a JSP bean that is a String containing the value for the request parameter named by paramId (if paramProperty is not specified), or a JSP bean whose property getter is called to return a String (if paramProperty is specified). The JSP bean is constrained to the bean scope specified by the paramScope property, if it is specified.

(RT EXPR)
paramProperty

The name of a property of the bean specified by the paramName attribute, whose return value must be a String containing the value of the request parameter (named by the paramId attribute) that will be dynamically added to this src URL.

(RT EXPR)
paramScope

The scope within which to search for the bean specified by the paramName attribute. If not specified, all scopes are searched.

(RT EXPR)
property

The name of a property of the bean specified by the name attribute, whose return value must be a java.util.Map containing the query parameters to be added to the src URL. You must specify the name attribute if you specify this attribute.

(RT EXPR)
scope

The scope within which to search for the bean specified by the name attribute. If not specified, all scopes are searched.

(RT EXPR)
src

The URL to which this image will be transferred from This image may be dynamically modified by the inclusion of query parameters, as described in the tag description. This value will be used unmodified (other than potential URL rewriting) as the value of the "src" attribute in the rendered tag. You must specify either the page attribute or the src attribute.

(RT EXPR)
srcKey

The message key, in the message resources bundle named by the bundle attribute, of the String to be used as the URL of this image.

(RT EXPR)
style

CSS styles to be applied to this element.

(RT EXPR)
styleClass | CSS stylesheet class to be applied to this HTML element (renders a "class" attribute). (RT EXPR)
styleId | Identifier to be assigned to this HTML element (renders an "id" attribute). (RT EXPR)
title

The advisory title for this element.

(RT EXPR)
titleKey

The message resources key for the advisory title for this element.

(RT EXPR)
usemap

The name of the map as defined within this page for mapping hot-spot areas of this image.

(RT EXPR)
vspace

The amount of vertical spacing between the icon and the text, above and below.

(RT EXPR)
width

The width of the image being displayed. This parameter is very nice to specify (along with height) to help the browser render the page faster.

(RT EXPR)


The Struts Framework Project - HTML Tags

javascript - Render JavaScript validation based on the validation rules loaded by the ValidatorPlugIn.

Render JavaScript validation based on the validation rules loaded by the ValidatorPlugIn. The set of validation rules that should be generated is based on the formName attribute passed in, which should match the name attribute of the form element in the xml file.

The dynamicJavascript and staticJavascript attributes default to true, but if dynamicJavascript is set to true and staticJavascript is set to false then only the dynamic JavaScript will be rendered. If dynamicJavascript is set to false and staticJavascript is set to true then only the static JavaScript will be rendered which can then be put in separate JSP page so the browser can cache the static JavaScript.

Attribute Name Description
cdata

Since: Struts 1.1

If set to "true" and XHTML has been enabled, the JavaScript will be wrapped in a CDATA section to prevent XML parsing. The default is "true" to comply with the W3C's recommendation.

(RT EXPR)
dynamicJavascript

Whether or not to render the dynamic JavaScript. Defaults to true.

formName

The key (form name) to retrieve a specific set of validation rules.

(RT EXPR)
htmlComment

Whether or not to enclose the javascript with HTML comments. This attribute is ignored in XHTML mode because the script would be deleted by the XML parser. See the cdata attribute for details on hiding scripts from XML parsers. Defaults to true.

(RT EXPR)
method

The alternate JavaScript method name to be used instead of the of the default. The default is 'validate' concatenated in front of the key (form name) passed in (ex: validateRegistrationForm).

(RT EXPR)
page

The current page of a set of validation rules if the page attribute for the field element in the xml file is in use.

(RT EXPR)
scriptLanguage

Since: Struts 1.2

The <script> element will not contain a language attribute when this is set to false. The default is true but this property is ignored in XHMTL mode. (RT EXPR)
src

The src attribute's value when defining the html script element.

(RT EXPR)
staticJavascript

Whether or not to render the static JavaScript. Defaults to true.


The Struts Framework Project - HTML Tags

link - Render an HTML anchor or hyperlink

Renders an HTML <a> element as an anchor definition (if "linkName" is specified) or as a hyperlink to the specified URL. URL rewriting will be applied automatically, to maintain session state in the absence of cookies. The content displayed for this hyperlink will be taken from the body of this tag.

The base URL for this hyperlink is calculated based on which of the following attributes you specify (you must specify exactly one of them):

  • forward - Use the value of this attribute as the name of a global ActionForward to be looked up, and use the application-relative or context-relative URI found there.
  • action - Use the value of this attribute as the name of a Action to be looked up, and use the application-relative or context-relative URI found there.
  • href - Use the value of this attribute unchanged.
  • page - Use the value of this attribute as a application-relative URI, and generate a server-relative URI by including the context path and application prefix.

Normally, the hyperlink you specify with one of the attributes described in the previous paragraph will be left unchanged (other than URL rewriting if necessary). However, there are two ways you can append one or more dynamically defined query parameters to the hyperlink -- specify a single parameter with the paramId attribute (and its associated attributes to select the value), or specify the name (and optional property) attributes to select a java.util.Map bean that contains one or more parameter ids and corresponding values.

To specify a single parameter, use the paramId attribute to define the name of the request parameter to be submitted. To specify the corresponding value, use one of the following approaches:

  • Specify only the paramName attribute - The named JSP bean (optionally scoped by the value of the paramScope attribute) must identify a value that can be converted to a String.
  • Specify both the paramName and paramProperty attributes - The specified property getter method will be called on the JSP bean identified by the paramName (and optional paramScope) attributes, in order to select a value that can be converted to a String.

If you prefer to specify a java.util.Map that contains all of the request parameters to be added to the hyperlink, use one of the following techniques:

  • Specify only the name attribute - The named JSP bean (optionally scoped by the value of the scope attribute) must identify a java.util.Map containing the parameters.
  • Specify both name and property attributes - The specified property getter method will be called on the bean identified by the name (and optional scope) attributes, in order to return the java.util.Map containing the parameters.

As the Map is processed, the keys are assumed to be the names of query parameters to be appended to the hyperlink. The value associated with each key must be either a String or a String array representing the parameter value(s), or an object whose toString() method will be called. If a String array is specified, more than one value for the same query parameter name will be created.

Additionally, you can request that the current transaction control token, if any, be included in the generated hyperlink by setting the transaction attribute to true. You can also request that an anchor ("#xxx") be added to the end of the URL that is created by any of the above mechanisms, by using the anchor attribute.
Attribute Name | Description
accesskey

The keyboard character used to move focus immediately to this element.

(RT EXPR)
action

Logical name of a Action that contains the actual content-relative URI of the destination of this transfer. This hyperlink may be dynamically modified by the inclusion of query parameters, as described in the tag description. You must specify exactly one of the action attribute, the forward attribute, the href attribute, the linkName attribute, or the page attribute.

(RT EXPR)
anchor

Optional anchor tag ("#xxx") to be added to the generated hyperlink. Specify this value without any "#" character.

(RT EXPR)
forward

Logical name of a global ActionForward that contains the actual content-relative URI of the destination of this transfer. This hyperlink may be dynamically modified by the inclusion of query parameters, as described in the tag description. You must specify exactly one of the action attribute, the forward attribute, the href attribute, the linkName attribute, or the page attribute.

(RT EXPR)
href

The URL to which this hyperlink will transfer control if activated. This hyperlink may be dynamically modified by the inclusion of query parameters, as described in the tag description. You must specify exactly one of the action attribute, the forward attribute, the href attribute, the linkName attribute, or the page attribute.

(RT EXPR)
indexed | Valid only inside of logic:iterate tag. If true then indexed parameter with name from indexId attribute will be added to the query string. Indexed parameter looks like "index[32]". Number in brackets will be generated for every iteration and taken from ancestor logic:iterate tag. (RT EXPR)
indexId | By this attribute different name for the indexed parameter can be specified. Take a look to the "indexed" attribute for details. (RT EXPR)
linkName

The anchor name to be defined within this page, so that you can reference it with intra-page hyperlinks. In other words, the value specified here will render a "name" element in the generated anchor tag.

(RT EXPR)
name

The name of a JSP bean that contains a Map representing the query parameters (if property is not specified), or a JSP bean whose property getter is called to return a Map (if property is specified).

(RT EXPR)
onblur

JavaScript event handler that is executed when this element loses input focus.

(RT EXPR)
onclick

JavaScript event handler that is executed when this element receives a mouse click.

(RT EXPR)
ondblclick

JavaScript event handler that is executed when this element receives a mouse double click.

(RT EXPR)
onfocus

JavaScript event handler that is executed when this element receives input focus.

(RT EXPR)
onkeydown

JavaScript event handler that is executed when this element receives a key down event.

(RT EXPR)
onkeypress

JavaScript event handler that is executed when this element receives a key press event.

(RT EXPR)
onkeyup

JavaScript event handler that is executed when this element receives a key up event.

(RT EXPR)
onmousedown

JavaScript event handler that is executed when this element receives a mouse down event.

(RT EXPR)
onmousemove

JavaScript event handler that is executed when this element receives a mouse move event.

(RT EXPR)
onmouseout

JavaScript event handler that is executed when this element receives a mouse out event.

(RT EXPR)
onmouseover

JavaScript event handler that is executed when this element receives a mouse over event.

(RT EXPR)
onmouseup

JavaScript event handler that is executed when this element receives a mouse up event.

(RT EXPR)
page

The module-relative path (beginning with a "/" character) to which this hyperlink will transfer control if activated. This hyperlink may be dynamically modified by the inclusion of query parameters, as described in the tag description. You must specify exactly one of the action attribute, forward attribute, the href attribute, the linkName attribute, or the page attribute.

(RT EXPR)
paramId

The name of the request parameter that will be dynamically added to the generated hyperlink. The corresponding value is defined by the paramName and (optional) paramProperty attributes, optionally scoped by the paramScope attribute

(RT EXPR)
paramName

The name of a JSP bean that is a String containing the value for the request parameter named by paramId (if paramProperty is not specified), or a JSP bean whose property getter is called to return a String (if paramProperty is specified). The JSP bean is constrained to the bean scope specified by the paramScope property, if it is specified.

(RT EXPR)
paramProperty

The name of a property of the bean specified by the paramName attribute, whose return value must be a String containing the value of the request parameter (named by the paramId attribute) that will be dynamically added to this hyperlink.

(RT EXPR)
paramScope

The scope within which to search for the bean specified by the paramName attribute. If not specified, all scopes are searched.

(RT EXPR)
property

The name of a property of the bean specified by the name attribute, whose return value must be a java.util.Map containing the query parameters to be added to the hyperlink. You must specify the name attribute if you specify this attribute.

(RT EXPR)
scope

The scope within which to search for the bean specified by the name attribute. If not specified, all scopes are searched.

(RT EXPR)
style

CSS styles to be applied to this element.

(RT EXPR)
styleClass | CSS stylesheet class to be applied to this HTML element (renders a "class" attribute). (RT EXPR)
styleId | Identifier to be assigned to this HTML element (renders an "id" attribute). (RT EXPR)
tabindex

The tab order (ascending positive integers) for this element.

(RT EXPR)
target

The window target in which the resource requested by this hyperlink will be displayed, for example in a framed presentation.

(RT EXPR)
title

The advisory title for this hyperlink.

(RT EXPR)
titleKey

The message resources key for the advisory title for this element.

(RT EXPR)
transaction

If set to true, any current transaction control token will be included in the generated hyperlink, so that it will pass an isTokenValid() test in the receiving Action.

(RT EXPR)


The Struts Framework Project - HTML Tags

multibox - Render A Checkbox Input Field

Renders an HTML <input> element of type checkbox, whose "checked" status is initialized based on whether the specified value matches one of the elements of the underlying property's array of current values. This element is useful when you have large numbers of checkboxes, and prefer to combine the values into a single array-valued property instead of multiple boolean properties. This tag is only valid when nested inside a form tag body.

WARNING: In order to correctly recognize cases where none of the associated checkboxes are selected, the ActionForm bean associated with this form must include a statement setting the corresponding array to zero length in the reset() method.

The value to be returned to the server, if this checkbox is selected, must be defined by one of the following methods:

  • Specify a value attribute, whose contents will be used literally as the value to be returned.
  • Specify no value attribute, and the nested body content of this tag will be used as the value to be returned.
Attribute Name | Description
accesskey | The keyboard character used to move focus immediately to this element. (RT EXPR)
alt

The alternate text for this element.

(RT EXPR)
altKey

The message resources key of the alternate text for this element.

(RT EXPR)
disabled | Set to true if this input field should be disabled. (RT EXPR)
name | The attribute name of the bean whose properties are consulted when rendering the current value of this input field. If not specified, the bean associated with the form tag we are nested within is utilized. (RT EXPR)
onblur | JavaScript event handler executed when this element loses input focus. (RT EXPR)
onchange | JavaScript event handler executed when this element loses input focus and its value has changed. (RT EXPR)
onclick | JavaScript event handler executed when this element receives a mouse click. (RT EXPR)
ondblclick | JavaScript event handler executed when this element receives a mouse double click. (RT EXPR)
onfocus | JavaScript event handler executed when this element receives input focus. (RT EXPR)
onkeydown | JavaScript event handler executed when this element has focus and a key is depressed. (RT EXPR)
onkeypress | JavaScript event handler executed when this element has focus and a key is depressed and released. (RT EXPR)
onkeyup | JavaScript event handler executed when this element has focus and a key is released. (RT EXPR)
onmousedown | JavaScript event handler executed when this element is under the mouse pointer and a mouse button is depressed. (RT EXPR)
onmousemove | JavaScript event handler executed when this element is under the mouse pointer and the pointer is moved. (RT EXPR)
onmouseout | JavaScript event handler executed when this element was under the mouse pointer but the pointer was moved outside the element. (RT EXPR)
onmouseover | JavaScript event handler executed when this element was not under the mouse pointer but the pointer is moved inside the element. (RT EXPR)
onmouseup | JavaScript event handler executed when this element is under the mouse pointer and a mouse button is released. (RT EXPR)
property | Name of the request parameter that will be included with this submission, set to the specified value. (REQUIRED) (RT EXPR)
style | CSS styles to be applied to this HTML element. (RT EXPR)
styleClass | CSS stylesheet class to be applied to this HTML element (renders a "class" attribute). (RT EXPR)
styleId | Identifier to be assigned to this HTML element (renders an "id" attribute). (RT EXPR)
tabindex | The tab order (ascending positive integers) for this element. (RT EXPR)
title

The advisory title for this element.

(RT EXPR)
titleKey

The message resources key for the advisory title for this element.

(RT EXPR)
value | The value to be transmitted if this checkbox is checked when the form is submitted. (RT EXPR)


The Struts Framework Project - HTML Tags

option - Render A Select Option

Render an HTML <option> element, representing one of the choices for an enclosing <select> element. The text displayed to the user comes from either the body of this tag, or from a message string looked up based on the bundle, locale, and key attributes.

If the value of the corresponding bean property matches the specified value, this option will be marked selected. This tag is only valid when nested inside a <html:select> tag body.
Attribute Name | Description
bundle | The servlet context attributes key for the MessageResources instance to use. If not specified, defaults to the application resources configured for our action servlet. (RT EXPR)
disabled | Set to true if this option should be disabled. (RT EXPR)
key | If specified, defines the message key to be looked up in the resource bundle specified by bundle for the text displayed to the user for this option. If not specified, the text to be displayed is taken from the body content of this tag. (RT EXPR)
locale | The session attributes key for the Locale instance to use for looking up the message specified by the key attribute. If not specified, uses the standard Struts session attribute name. (RT EXPR)
style | CSS styles to be applied to this HTML element. (RT EXPR)
styleClass | CSS stylesheet class to be applied to this HTML element (renders a "class" attribute). (RT EXPR)
styleId | Identifier to be assigned to this HTML element (renders an "id" attribute). (RT EXPR)
value | Value to be submitted for this field if this option is selected by the user. (REQUIRED) (RT EXPR)


The Struts Framework Project - HTML Tags

options - Render a Collection of Select Options

Renders a set of HTML <option> elements, representing possible choices for a <select> element. This tag can be used multiple times within a single <html:select> element, either in conjunction with or instead of one or more <html:option> or <html:optionsCollection> elements.

This tag operates in one of two major modes, depending on whether or not the collection attribute is specified. If the collection attribute is included, the following rules apply:

  • The collection attribute is interpreted as the name of a JSP bean, in some scope, that itself represents a collection of individual beans, one per option value to be rendered.
  • The property attribute is interpreted as the name of a property of the individual beans included in the collection, and is used to retrieve the value that will be returned to the server if this option is selected.
  • The labelProperty attribute is interpreted as the name of a property of the individual beans included in the collection, and is used to retrieve the label that will be displayed to the user for this option. If the labelProperty attribute is not specified, the property named by the property attribute will be used to select both the value returned to the server and the label displayed to the user for this option.

If the collection attribute is not specified, the rules described in the remainder of this section apply.

The collection of values actually selected depends on the presence or absence of the name and property attributes. The following combinations are allowed:

  • Only name is specified - The value of this attribute is the name of a JSP bean in some scope that is the collection.
  • Only property is specified - The value of this attribute is the name of a property of the ActionForm bean associated with our form, which will return the collection.
  • Both name and property are specified - The value of the name attribute identifies a JSP bean in some scope. The value of the property attribute is the name of some property of that bean which will return the collection.

The collection of labels displayed to the user can be the same as the option values themselves, or can be different, depending on the presence or absence of the labelName and labelProperty attributes. If this feature is used, the collection of labels must contain the same number of elements as the corresponding collection of values. The following combinations are allowed:

  • Neither labelName nor labelProperty is specified - The labels will be the same as the option values themselves.
  • Only labelName is specified - The value of this attribute is the name of a JSP bean in some scope that is the collection.
  • Only labelProperty is specified - The value of this attribute is the name of a property of the ActionForm bean associated with our form, which will return the collection.
  • Both labelName and labelProperty are specified - The value of the labelName attribute identifies a JSP bean in some scope. The value of the labelProperty attribute is the name of some property of that bean which will return the collection.

Note that this tag does not support a styleId attribute, as it would have to apply the value to all the option elements created by this element, which would mean that more than one id element might have the same value, which the HTML specification says is illegal.
Attribute Name | Description
collection | Name of the JSP bean (in some scope) which is itself a Collection of other beans, each of which has properties named by the "property" and "labelProperty" attributes that are used to retrieve the value and label for each option, respectively. (RT EXPR)
filter | Set to false if you do NOT want the option labels filtered for sensitive characters in HTML. By default, such values are filtered. (RT EXPR)
labelName | Name of the JSP bean (in some scope) containing the collection of labels to be displayed to the user for these options. (RT EXPR)
labelProperty | Property of the form bean, or the bean specified by the labelName attribute, that will return the collection of labels to be displayed to the user for these options. (RT EXPR)
name | Name of the JSP bean (in some scope) containing the collection of values to be returned to the server for these options. If not specified, the form bean associated with our form is assumed. (RT EXPR)
property | Property of the form bean, or the bean specified by the name attribute, that will return the collection of values to returned to the server for these options. (RT EXPR)
style | CSS styles to be applied to this HTML element. (RT EXPR)
styleClass | CSS stylesheet class to be applied to this HTML element (renders a "class" attribute). (RT EXPR)


The Struts Framework Project - HTML Tags

optionsCollection - Render a Collection of Select Options

Renders a set of HTML <option> elements, representing possible choices for a <select> element. This tag can be used multiple times within a single <html:select> element, either in conjunction with or instead of one or more <html:option> or <html:options> elements.

This tag operates on a collection of beans, where each bean has a label property and a value property. The actual names of these properties can be configured using the label and value attributes of this tag.

This tag differs from the <html:options> tag in that it makes more consistent use of the name and property attributes, and allows the collection to be more easily obtained from the enclosing form bean.

Note that this tag does not support a styleId attribute, as it would have to apply the value to all the option elements created by this element, which would mean that more than one id element might have the same value, which the HTML specification says is illegal.
Attribute Name | Description
filter | Set to false if you do NOT want the option labels filtered for sensitive characters in HTML. By default, such values are filtered. (RT EXPR)
label | The property of the bean within the collection which represents the label to be rendered for each option. Defaults to "label". (RT EXPR)
name | The attribute name of the bean whose properties are consulted when rendering the current value of this input field. If not specified, the bean associated with the form tag we are nested within is utilized. (RT EXPR)
property | The property of the form bean, or the bean specified by the name attribute, that will return the collection of objects to be rendered for these options. (RT EXPR)
style | CSS styles to be applied to this HTML element. (RT EXPR)
styleClass | CSS stylesheet class to be applied to this HTML element (renders a "class" attribute). (RT EXPR)
value | The property of the bean within the collection which represents the value to be rendered for each option. Defaults to "value". (RT EXPR)


The Struts Framework Project - HTML Tags

password - Render A Password Input Field
Renders an HTML <input> element of type password, populated from the specified value or the specified property of the bean associated with our current form. This tag is only valid when nested inside a form tag body.
Attribute Name | Description
accesskey | The keyboard character used to move focus immediately to this element. (RT EXPR)
alt

The alternate text for this element.

(RT EXPR)
altKey

The message resources key of the alternate text for this element.

(RT EXPR)
disabled | Set to true if this input field should be disabled. (RT EXPR)
indexed | Valid only inside of logic:iterate tag. If true then name of the html tag will be rendered as "id[34].propertyName". Number in brackets will be generated for every iteration and taken from ancestor logic:iterate tag. (RT EXPR)
maxlength | Maximum number of input characters to accept. [No limit] (RT EXPR)
name | The attribute name of the bean whose properties are consulted when rendering the current value of this input field. If not specified, the bean associated with the form tag we are nested within is utilized. (RT EXPR)
onblur | JavaScript event handler executed when this element loses input focus. (RT EXPR)
onchange | JavaScript event handler executed when this element loses input focus and its value has changed. (RT EXPR)
onclick | JavaScript event handler executed when this element receives a mouse click. (RT EXPR)
ondblclick | JavaScript event handler executed when this element receives a mouse double click. (RT EXPR)
onfocus | JavaScript event handler executed when this element receives input focus. (RT EXPR)
onkeydown | JavaScript event handler executed when this element has focus and a key is depressed. (RT EXPR)
onkeypress | JavaScript event handler executed when this element has focus and a key is depressed and released. (RT EXPR)
onkeyup | JavaScript event handler executed when this element has focus and a key is released. (RT EXPR)
onmousedown | JavaScript event handler executed when this element is under the mouse pointer and a mouse button is depressed. (RT EXPR)
onmousemove | JavaScript event handler executed when this element is under the mouse pointer and the pointer is moved. (RT EXPR)
onmouseout | JavaScript event handler executed when this element was under the mouse pointer but the pointer was moved outside the element. (RT EXPR)
onmouseover | JavaScript event handler executed when this element was not under the mouse pointer but the pointer is moved inside the element. (RT EXPR)
onmouseup | JavaScript event handler executed when this element is under the mouse pointer and a mouse button is released. (RT EXPR)
property | Name of the request parameter that will be included with this submission, set to the specified value. (REQUIRED) (RT EXPR)
readonly | Set to true if this input field should be read only. (RT EXPR)
redisplay | Boolean flag indicating whether or not existing values will be redisplayed if they exist. Even though the redisplayed value will be shown as asterisks on the visible HTML page, the cleartext of the actual password value will be visible though the "Show Page Source" menu option of the client browser. You may wish to set this value to false on login pages. Defaults to true for consistency with all other form tags that redisplay their contents. (RT EXPR)
size | Number of character positions to allocate. [Browser default] (RT EXPR)
style | CSS styles to be applied to this HTML element. (RT EXPR)
styleClass | CSS stylesheet class to be applied to this HTML element (renders a "class" attribute). (RT EXPR)
styleId | Identifier to be assigned to this HTML element (renders an "id" attribute). (RT EXPR)
tabindex | The tab order (ascending positive integers) for this element. (RT EXPR)
title

The advisory title for this element.

(RT EXPR)
titleKey

The message resources key for the advisory title for this element.

(RT EXPR)
value | Value of the label to be placed on this button. This value will also be submitted as the value of the specified request parameter. [Body of this tag (if any)] (RT EXPR)


The Struts Framework Project - HTML Tags

radio - Render A Radio Button Input Field

Renders an HTML <input> element of type radio, populated from the specified property of the bean associated with our current form. This tag is only valid when nested inside a form tag body.

If an iterator is used to render a series of radio tags, the idName attribute may be used to specify the name of the bean exposed by the iterator. In this case, the value attribute is used as the name of a property on the idName bean that returns the value of the radio tag in this iteration.

Attribute Name | Description
accesskey | The keyboard character used to move focus immediately to this element. (RT EXPR)
alt

The alternate text for this element.

(RT EXPR)
altKey

The message resources key of the alternate text for this element.

(RT EXPR)
disabled | Set to true if this input field should be disabled. (RT EXPR)
idName

Since: Struts 1.1

Name of the bean (in some scope) that will return the value of the radio tag. Usually exposed by an iterator. When the idName attribute is present, the value attribute is used as the name of the property on the idName bean that will return the value of the radio tag for this iteration.

(RT EXPR)
indexed | Valid only inside of logic:iterate tag. If true then name of the html tag will be rendered as "id[34].propertyName". Number in brackets will be generated for every iteration and taken from ancestor logic:iterate tag. (RT EXPR)
name | The attribute name of the bean whose properties are consulted when rendering the current value of this input field. If not specified, the bean associated with the form tag we are nested within is utilized. (RT EXPR)
onblur | JavaScript event handler executed when this element loses input focus. (RT EXPR)
onchange | JavaScript event handler executed when this element loses input focus and its value has changed. (RT EXPR)
onclick | JavaScript event handler executed when this element receives a mouse click. (RT EXPR)
ondblclick | JavaScript event handler executed when this element receives a mouse double click. (RT EXPR)
onfocus | JavaScript event handler executed when this element receives input focus. (RT EXPR)
onkeydown | JavaScript event handler executed when this element has focus and a key is depressed. (RT EXPR)
onkeypress | JavaScript event handler executed when this element has focus and a key is depressed and released. (RT EXPR)
onkeyup | JavaScript event handler executed when this element has focus and a key is released. (RT EXPR)
onmousedown | JavaScript event handler executed when this element is under the mouse pointer and a mouse button is depressed. (RT EXPR)
onmousemove | JavaScript event handler executed when this element is under the mouse pointer and the pointer is moved. (RT EXPR)
onmouseout | JavaScript event handler executed when this element was under the mouse pointer but the pointer was moved outside the element. (RT EXPR)
onmouseover | JavaScript event handler executed when this element was not under the mouse pointer but the pointer is moved inside the element. (RT EXPR)
onmouseup | JavaScript event handler executed when this element is under the mouse pointer and a mouse button is released. (RT EXPR)
property | The corresponding bean property for this radio tag. (REQUIRED) (RT EXPR)
style | CSS styles to be applied to this HTML element. (RT EXPR)
styleClass | CSS stylesheet class to be applied to this HTML element (renders a "class" attribute). (RT EXPR)
styleId | Identifier to be assigned to this HTML element (renders an "id" attribute). (RT EXPR)
tabindex | The tab order (ascending positive integers) for this element. (RT EXPR)
title

The advisory title for this element.

(RT EXPR)
titleKey

The message resources key for the advisory title for this element.

(RT EXPR)
value | The value of the radio tag. (REQUIRED) (RT EXPR)


The Struts Framework Project - HTML Tags

reset - Render A Reset Button Input Field
Renders an HTML <input> element of type reset.
Attribute Name | Description
accesskey | The keyboard character used to move focus immediately to this element. (RT EXPR)
alt

The alternate text for this element.

(RT EXPR)
altKey

The message resources key of the alternate text for this element.

(RT EXPR)
disabled | Set to true if this input field should be disabled. (RT EXPR)
onblur | JavaScript event handler executed when this element loses input focus. (RT EXPR)
onchange | JavaScript event handler executed when this element loses input focus and its value has changed. (RT EXPR)
onclick | JavaScript event handler executed when this element receives a mouse click. (RT EXPR)
ondblclick | JavaScript event handler executed when this element receives a mouse double click. (RT EXPR)
onfocus | JavaScript event handler executed when this element receives input focus. (RT EXPR)
onkeydown | JavaScript event handler executed when this element has focus and a key is depressed. (RT EXPR)
onkeypress | JavaScript event handler executed when this element has focus and a key is depressed and released. (RT EXPR)
onkeyup | JavaScript event handler executed when this element has focus and a key is released. (RT EXPR)
onmousedown | JavaScript event handler executed when this element is under the mouse pointer and a mouse button is depressed. (RT EXPR)
onmousemove | JavaScript event handler executed when this element is under the mouse pointer and the pointer is moved. (RT EXPR)
onmouseout | JavaScript event handler executed when this element was under the mouse pointer but the pointer was moved outside the element. (RT EXPR)
onmouseover | JavaScript event handler executed when this element was not under the mouse pointer but the pointer is moved inside the element. (RT EXPR)
onmouseup | JavaScript event handler executed when this element is under the mouse pointer and a mouse button is released. (RT EXPR)
property | Name of the input field that will be generated. (RT EXPR)
style | CSS styles to be applied to this HTML element. (RT EXPR)
styleClass | CSS stylesheet class to be applied to this HTML element (renders a "class" attribute). (RT EXPR)
styleId | Identifier to be assigned to this HTML element (renders an "id" attribute). (RT EXPR)
tabindex | The tab order (ascending positive integers) for this element. (RT EXPR)
title

The advisory title for this element.

(RT EXPR)
titleKey

The message resources key for the advisory title for this element.

(RT EXPR)
value | Value of the label to be placed on this button. [Body of this tag (if any), or "Reset"] (RT EXPR)


The Struts Framework Project - HTML Tags

rewrite - Render an URI

Renders a request URI based on exactly the same rules as the link tag does, but without creating the <a> hyperlink. This value is useful when you want to generate a string constant for use by a JavaScript procedure.
Attribute Name Description
action

Logical name of a Action that contains the actual content-relative URI of the destination of this transfer. This hyperlink may be dynamically modified by the inclusion of query parameters, as described in the tag description. You must specify exactly one of the action attribute, the forward attribute, the href attribute, or the page attribute.

(RT EXPR)
anchor

Optional anchor tag ("#xxx") to be added to the generated hyperlink. Specify this value without any "#" character.

(RT EXPR)
forward

Logical name of a global ActionForward that contains the actual content-relative URI of the destination of this transfer. This hyperlink may be dynamically modified by the inclusion of query parameters, as described in the tag description. You must specify exactly one of the action attribute, the forward attribute, the href attribute, or the page attribute.

(RT EXPR)
href

The URL to which this hyperlink will transfer control if activated. This hyperlink may be dynamically modified by the inclusion of query parameters, as described in the tag description. You must specify exactly one of the action attribute, the forward attribute, the href attribute, or the page attribute.

(RT EXPR)
name

The name of a JSP bean that contains a Map representing the query parameters (if property is not specified), or a JSP bean whose property getter is called to return a Map (if property is specified).

(RT EXPR)
page

The module-relative path (beginning with a "/" character) to which this hyperlink will transfer control if activated. This hyperlink may be dynamically modified by the inclusion of query parameters, as described in the tag description. You must specify exactly one of the action attribute, the forward attribute, the href attribute, or the page attribute.

(RT EXPR)
paramId

The name of the request parameter that will be dynamically added to the generated hyperlink. The corresponding value is defined by the paramName and (optional) paramProperty attributes, optionally scoped by the paramScope attribute

(RT EXPR)
paramName

The name of a JSP bean that is a String containing the value for the request parameter named by paramId (if paramProperty is not specified), or a JSP bean whose property getter is called to return a String (if paramProperty is specified). The JSP bean is constrained to the bean scope specified by the paramScope property, if it is specified.

(RT EXPR)
paramProperty

The name of a property of the bean specified by the paramName attribute, whose return value must be a String containing the value of the request parameter (named by the paramId attribute) that will be dynamically added to this hyperlink.

(RT EXPR)
paramScope

The scope within which to search for the bean specified by the paramName attribute. If not specified, all scopes are searched.

(RT EXPR)
property

The name of a property of the bean specified by the name attribute, whose return value must be a java.util.Map containing the query parameters to be added to the hyperlink. You must specify the name attribute if you specify this attribute.

(RT EXPR)
scope

The scope within which to search for the bean specified by the name attribute. If not specified, all scopes are searched.

(RT EXPR)
transaction

If set to true, any current transaction control token will be included in the generated hyperlink, so that it will pass an isTokenValid() test in the receiving Action.

(RT EXPR)


The Struts Framework Project - HTML Tags

select - Render A Select Element

Renders an HTML <select> element, associated with a bean property specified by our attributes. This tag is only valid when nested inside a form tag body.

This tag operates in two modes, depending upon the state of the multiple attribute, which affects the data type of the associated property you should use:

  • multiple="true" IS NOT selected - The corresponding property should be a scalar value of any supported data type.
  • multiple="true" IS selected - The corresponding property should be an array of any supported data type.

WARNING: In order to correctly recognize cases where no selection at all is made, the ActionForm bean associated with this form must include a statement resetting the scalar property to a default value (if multiple is not set), or the array property to zero length (if multiple is set) in the reset() method.
Attribute Name | Description
alt

The alternate text for this element.

(RT EXPR)
altKey

The message resources key of the alternate text for this element.

(RT EXPR)
disabled | Set to true if this input field should be disabled. (RT EXPR)
indexed | Valid only inside of logic:iterate tag. If true then name of the html tag will be rendered as "id[34].propertyName". Number in brackets will be generated for every iteration and taken from ancestor logic:iterate tag. (RT EXPR)
multiple | If set to any arbitrary value, the rendered select element will support multiple selections. (RT EXPR)
name | The attribute name of the bean whose properties are consulted to determine which option should be pre-selected when rendering this input field. If not specified, the bean associated with the enclosing <html:form> tag is utilized. (RT EXPR)
onblur | JavaScript event handler executed when this element loses input focus. (RT EXPR)
onchange | JavaScript event handler executed when this element loses input focus and its value has changed. (RT EXPR)
onclick | JavaScript event handler executed when this element receives a mouse click. (RT EXPR)
ondblclick | JavaScript event handler executed when this element receives a mouse double click. (RT EXPR)
onfocus | JavaScript event handler executed when this element receives input focus. (RT EXPR)
onkeydown | JavaScript event handler executed when this element has focus and a key is depressed. (RT EXPR)
onkeypress | JavaScript event handler executed when this element has focus and a key is depressed and released. (RT EXPR)
onkeyup | JavaScript event handler executed when this element has focus and a key is released. (RT EXPR)
onmousedown | JavaScript event handler executed when this element is under the mouse pointer and a mouse button is depressed. (RT EXPR)
onmousemove | JavaScript event handler executed when this element is under the mouse pointer and the pointer is moved. (RT EXPR)
onmouseout | JavaScript event handler executed when this element was under the mouse pointer but the pointer was moved outside the element. (RT EXPR)
onmouseover | JavaScript event handler executed when this element was not under the mouse pointer but the pointer is moved inside the element. (RT EXPR)
onmouseup | JavaScript event handler executed when this element is under the mouse pointer and a mouse button is released. (RT EXPR)
property | Name of the request parameter that will be included with this submission, set to the specified value. (REQUIRED) (RT EXPR)
size | The number of available options displayed at one time. (RT EXPR)
style | CSS styles to be applied to this HTML element. (RT EXPR)
styleClass | CSS stylesheet class to be applied to this HTML element (renders a "class" attribute). (RT EXPR)
styleId | Identifier to be assigned to this HTML element (renders an "id" attribute). (RT EXPR)
tabindex | The tab order (ascending positive integers) for this element. (RT EXPR)
title

The advisory title for this element.

(RT EXPR)
titleKey

The message resources key for the advisory title for this element.

(RT EXPR)
value | The value to compare with for marking an option selected. (RT EXPR)


The Struts Framework Project - HTML Tags

submit - Render A Submit Button
Renders an HTML <input> element of type submit.

If a graphical button is needed (a button with an image), then the image tag is more appropriate.

Attribute Name | Description
accesskey | The keyboard character used to move focus immediately to this element. (RT EXPR)
alt

The alternate text for this element.

(RT EXPR)
altKey

The message resources key of the alternate text for this element.

(RT EXPR)
disabled | Set to true if this input field should be disabled. (RT EXPR)
indexed | Valid only inside of logic:iterate tag. If true then name of the html tag will be rendered as "propertyName[34]". Number in brackets will be generated for every iteration and taken from ancestor logic:iterate tag. (RT EXPR)
onblur | JavaScript event handler executed when this element loses input focus. (RT EXPR)
onchange | JavaScript event handler executed when this element loses input focus and its value has changed. (RT EXPR)
onclick | JavaScript event handler executed when this element receives a mouse click. (RT EXPR)
ondblclick | JavaScript event handler executed when this element receives a mouse double click. (RT EXPR)
onfocus | JavaScript event handler executed when this element receives input focus. (RT EXPR)
onkeydown | JavaScript event handler executed when this element has focus and a key is depressed. (RT EXPR)
onkeypress | JavaScript event handler executed when this element has focus and a key is depressed and released. (RT EXPR)
onkeyup | JavaScript event handler executed when this element has focus and a key is released. (RT EXPR)
onmousedown | JavaScript event handler executed when this element is under the mouse pointer and a mouse button is depressed. (RT EXPR)
onmousemove | JavaScript event handler executed when this element is under the mouse pointer and the pointer is moved. (RT EXPR)
onmouseout | JavaScript event handler executed when this element was under the mouse pointer but the pointer was moved outside the element. (RT EXPR)
onmouseover | JavaScript event handler executed when this element was not under the mouse pointer but the pointer is moved inside the element. (RT EXPR)
onmouseup | JavaScript event handler executed when this element is under the mouse pointer and a mouse button is released. (RT EXPR)
property | Name of the request parameter that will be included with this submission, set to the specified value. (RT EXPR)
style | CSS styles to be applied to this HTML element. (RT EXPR)
styleClass | CSS stylesheet class to be applied to this HTML element (renders a "class" attribute). (RT EXPR)
styleId | Identifier to be assigned to this HTML element (renders an "id" attribute). (RT EXPR)
tabindex | The tab order (ascending positive integers) for this element. (RT EXPR)
title

The advisory title for this element.

(RT EXPR)
titleKey

The message resources key for the advisory title for this element.

(RT EXPR)
value | The value of the button label. (RT EXPR)


The Struts Framework Project - HTML Tags

text - Render An Input Field of Type text
Render an input button of type text. This tag is only valid when nested inside a form tag body.
Attribute Name | Description
accesskey | The keyboard character used to move focus immediately to this element. (RT EXPR)
alt

The alternate text for this element.

(RT EXPR)
altKey

The message resources key of the alternate text for this element.

(RT EXPR)
disabled | Set to true if this input field should be disabled. (RT EXPR)
indexed | Valid only inside of logic:iterate tag. If true then name of the html tag will be rendered as "id[34].propertyName". Number in brackets will be generated for every iteration and taken from ancestor logic:iterate tag. (RT EXPR)
maxlength | Maximum number of input characters to accept. [No limit] (RT EXPR)
name | The attribute name of the bean whose properties are consulted when rendering the current value of this input field. If not specified, the bean associated with the form tag we are nested within is utilized. (RT EXPR)
onblur | JavaScript event handler executed when this element loses input focus. (RT EXPR)
onchange | JavaScript event handler executed when this element loses input focus and its value has changed. (RT EXPR)
onclick | JavaScript event handler executed when this element receives a mouse click. (RT EXPR)
ondblclick | JavaScript event handler executed when this element receives a mouse double click. (RT EXPR)
onfocus | JavaScript event handler executed when this element receives input focus. (RT EXPR)
onkeydown | JavaScript event handler executed when this element has focus and a key is depressed. (RT EXPR)
onkeypress | JavaScript event handler executed when this element has focus and a key is depressed and released. (RT EXPR)
onkeyup | JavaScript event handler executed when this element has focus and a key is released. (RT EXPR)
onmousedown | JavaScript event handler executed when this element is under the mouse pointer and a mouse button is depressed. (RT EXPR)
onmousemove | JavaScript event handler executed when this element is under the mouse pointer and the pointer is moved. (RT EXPR)
onmouseout | JavaScript event handler executed when this element was under the mouse pointer but the pointer was moved outside the element. (RT EXPR)
onmouseover | JavaScript event handler executed when this element was not under the mouse pointer but the pointer is moved inside the element. (RT EXPR)
onmouseup | JavaScript event handler executed when this element is under the mouse pointer and a mouse button is released. (RT EXPR)
property | Name of this input field, and the name of the corresponding bean property if value is not specified. The corresponding bean property (if any) must be of type String. (REQUIRED) (RT EXPR)
readonly | Set to true if this input field should be read only. (RT EXPR)
size | Number of character positions to allocate. [Browser default] (RT EXPR)
style | CSS styles to be applied to this HTML element. (RT EXPR)
styleClass | CSS stylesheet class to be applied to this HTML element (renders a "class" attribute). (RT EXPR)
styleId | Identifier to be assigned to this HTML element (renders an "id" attribute). (RT EXPR)
tabindex | The tab order (ascending positive integers) for this element. (RT EXPR)
title

The advisory title for this element.

(RT EXPR)
titleKey

The message resources key for the advisory title for this element.

(RT EXPR)
value | Value to which this field should be initialized. [Use the corresponding bean property value] (RT EXPR)


The Struts Framework Project - HTML Tags

textarea - Render A Textarea
Render a textarea element. This tag is only valid when nested inside a form tag body.
Attribute Name | Description
accesskey | The keyboard character used to move focus immediately to this element. (RT EXPR)
alt

The alternate text for this element.

(RT EXPR)
altKey

The message resources key of the alternate text for this element.

(RT EXPR)
cols | The number of columns to display. (RT EXPR)
disabled | Set to true if this input field should be disabled. (RT EXPR)
indexed | Valid only inside of logic:iterate tag. If true then name of the html tag will be rendered as "id[34].propertyName". Number in brackets will be generated for every iteration and taken from ancestor logic:iterate tag. (RT EXPR)
name | The attribute name of the bean whose properties are consulted when rendering the current value of this input field. If not specified, the bean associated with the form tag we are nested within is utilized. (RT EXPR)
onblur | JavaScript event handler executed when this element loses input focus. (RT EXPR)
onchange | JavaScript event handler executed when this element loses input focus and its value has changed. (RT EXPR)
onclick | JavaScript event handler executed when this element receives a mouse click. (RT EXPR)
ondblclick | JavaScript event handler executed when this element receives a mouse double click. (RT EXPR)
onfocus | JavaScript event handler executed when this element receives input focus. (RT EXPR)
onkeydown | JavaScript event handler executed when this element has focus and a key is depressed. (RT EXPR)
onkeypress | JavaScript event handler executed when this element has focus and a key is depressed and released. (RT EXPR)
onkeyup | JavaScript event handler executed when this element has focus and a key is released. (RT EXPR)
onmousedown | JavaScript event handler executed when this element is under the mouse pointer and a mouse button is depressed. (RT EXPR)
onmousemove | JavaScript event handler executed when this element is under the mouse pointer and the pointer is moved. (RT EXPR)
onmouseout | JavaScript event handler executed when this element was under the mouse pointer but the pointer was moved outside the element. (RT EXPR)
onmouseover | JavaScript event handler executed when this element was not under the mouse pointer but the pointer is moved inside the element. (RT EXPR)
onmouseup | JavaScript event handler executed when this element is under the mouse pointer and a mouse button is released. (RT EXPR)
property | Name of this input field, and the name of the corresponding bean property if value is not specified. The corresponding bean property (if any) must be of type String. (REQUIRED) (RT EXPR)
readonly | Set to true if this input field should be read only. (RT EXPR)
rows | The number of rows to display. (RT EXPR)
style | CSS styles to be applied to this HTML element. (RT EXPR)
styleClass | CSS stylesheet class to be applied to this HTML element (renders a "class" attribute). (RT EXPR)
styleId | Identifier to be assigned to this HTML element (renders an "id" attribute). (RT EXPR)
tabindex | The tab order (ascending positive integers) for this element. (RT EXPR)
title

The advisory title for this element.

(RT EXPR)
titleKey

The message resources key for the advisory title for this element.

(RT EXPR)
value | Value to which this field should be initialized. [Use the corresponding bean property value] (RT EXPR)


The Struts Framework Project - HTML Tags

xhtml - Render HTML tags as XHTML

Using this tag in a page tells all other html taglib tags to render themselves as XHTML. This is useful when composing pages with JSP includes or Tiles. This tag has the same effect as using <html:html xhtml="true">.

Attribute Name Description


The Struts Framework Project - Bean Tags

Struts Bean Tags

This tag library contains tags useful in accessing beans and their properties, as well as defining new beans (based on these accesses) that are accessible to the remainder of the page via scripting variables and page scope attributes. Convenient mechanisms to create new beans based on the value of request cookies, headers, and parameters are also provided.

Many of the tags in this tag library will throw a JspException at runtime when they are utilized incorrectly (such as when you specify an invalid combination of tag attributes). JSP allows you to declare an "error page" in the <%@ page %> directive. If you wish to process the actual exception that caused the problem, it is passed to the error page as a request attribute under key org.apache.struts.action.EXCEPTION.

If you are viewing this page from within the Struts Documentation Application (or online at http://jakarta.apache.org/struts), you can learn more about using these tags in the Bean Tags Developer's Guide.
Tag Name | Description
cookie | Define a scripting variable based on the value(s) of the specified request cookie.
define | Define a scripting variable based on the value(s) of the specified bean property.
header | Define a scripting variable based on the value(s) of the specified request header.
include | Load the response from a dynamic application request and make it available as a bean.
message | Render an internationalized message string to the response.
page | Expose a specified item from the page context as a bean.
parameter | Define a scripting variable based on the value(s) of the specified request parameter.
resource | Load a web application resource and make it available as a bean.
size | Define a bean containing the number of elements in a Collection or Map.
struts | Expose a named Struts internal configuration object as a bean.
write | Render the value of the specified bean property to the current JspWriter.


The Struts Framework Project - Bean Tags

cookie - Define a scripting variable based on the value(s) of the specified request cookie.

Retrieve the value of the specified request cookie (as a single value or multiple values, depending on the multiple attribute), and define the result as a page scope attribute of type Cookie (if multiple is not specified) or Cookie[] (if multiple is specified).

If no cookie with the specified name can be located, and no default value is specified, a request time exception will be thrown.
Attribute Name 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 cookie.

(REQUIRED)
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.

(RT EXPR)
name

Specifies the name of the request cookie whose value, or values, is to be retrieved.

(REQUIRED) (RT EXPR)
value

The default cookie value to return if no cookie with the specified name was included in this request.

(RT EXPR)


The Struts Framework Project - Bean Tags

define - Define a scripting variable based on the value(s) of the specified bean property.

Create a new attribute (in the scope specified by the toScope property, if any), and a corresponding scripting variable, both of which are named by the value of the id attribute. The corresponding value to which this new attribute (and scripting variable) is set are specified via use of exactly one of the following approaches (trying to use more than one will result in a JspException being thrown):

  • Specify a name attribute (plus optional property and scope attributes) - The created attribute and scripting variable will be of the type of the retrieved JavaBean property, unless it is a Java primitive type, in which case it will be wrapped in the appropriate wrapper class (i.e. int is wrapped by java.lang.Integer).
  • Specify a value attribute - The created attribute and scripting variable will be of type java.lang.String, set to the value of this attribute.
  • Specify nested body content - The created attribute and scripting variable will be of type java.lang.String, set to the value of the nested body content.

If a problem occurs while retrieving the specified bean property, a request time exception will be thrown.

The <bean:define> tag differs from <jsp:useBean> in several ways, including:

  • Unconditionally creates (or replaces) a bean under the specified identifier.
  • Can create a bean with the value returned by a property getter of a different bean (including properties referenced with a nested and/or indexed property name).
  • Can create a bean whose contents is a literal string (or the result of a runtime expression) specified by the value attribute.
  • Does not support nested content (such as <jsp:setProperty> tags) that are only executed if a bean was actually created.

USAGE NOTE - There is a restriction in the JSP 1.1 Specification that disallows using the same value for an id attribute more than once in a single JSP page. Therefore, you will not be able to use <bean:define> for the same bean name more than once in a single page.

USAGE NOTE - If you use another tag to create the body content (e.g. bean:write), that tag must return a non-empty String. An empty String equates to an empty body or a null String, and a new scripting variable cannot be defined as null. Your bean must return a non-empty String, or the define tag must be wrapped within a logic tag to test for an empty or null value.

USAGE NOTE - You cannot use bean:define to instantiate a DynaActionForm (type="org.apache.struts.action.DynaActionForm") with the properties specified in the struts-config. The mechanics of creating the dyna-properties is complex and cannot be handled by a no-argument constructor. If you need to create an ActionForm this way, you must use a conventional ActionForm.

See the Bean Developer's Guide section on bean creation for more information about these differences, as well as alternative approaches to introducing beans into a JSP page.
Attribute Name 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.

(REQUIRED)
name

Specifies the attribute name of the bean whose property is accessed to define a new page scope attribute (if property is also specified) or the attribute name of the bean that is duplicated with the new reference created by this tag (if property is not also specified). This attribute is required unless you specify a value attribute or nested body content.

(RT EXPR)
property

Specifies the name of the property to be accessed on the bean specified by name. This value may be a simple, indexed, or nested property reference expression. If not specified, the bean identified by name is given a new reference identified by id.

(RT EXPR)
scope

Specifies the variable scope searched to retrieve the bean specified by name. If not specified, the default rules applied by PageContext.findAttribute() are applied.

(RT EXPR)
toScope

Specifies the variable scope into which the newly defined bean will be created. If not specified, the bean will be created in page scope.

(RT EXPR)
type

Specifies the fully qualified class name of the value to be exposed as the id attribute.

[ java.lang.String (if you specify a value attribute) or java.lang.Object otherwise. ] (RT EXPR)
value

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.

(RT EXPR)


The Struts Framework Project - Bean Tags

header - Define a scripting variable based on the value(s) of the specified request header.

Retrieve the value of the specified request header (as a single value or multiple values, depending on the multiple attribute), and define the result as a page scope attribute of type String (if multiple is not specified) or String[] (if multiple is specified).

If no header with the specified name can be located, and no default value is specified, a request time exception will be thrown.
Attribute Name 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 header.

(REQUIRED)
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.

(RT EXPR)
name

Specifies the name of the request header whose value, or values, is to be retrieved.

(REQUIRED) (RT EXPR)
value

The default header value to return if no header with the specified name was included in this request.

(RT EXPR)


The Struts Framework Project - Bean Tags

include - Load the response from a dynamic application request and make it available as a bean.

Perform an internal dispatch to the specified application component (or external URL) and make the response data from that request available as a bean of type String. This tag has a function similar to that of the standard <jsp:include> tag, except that the response data is stored in a page scope attribute instead of being written to the output stream. If the current request is part of a session, the generated request for the include will also include the session identifier (and thus be part of the same session).

The URL used to access the specified application component is calculated based on which of the following attributes you specify (you must specify exactly one of them):

  • forward - Use the value of this attribute as the name of a global ActionForward to be looked up, and use the application-relative or context-relative URI found there.
  • href - Use the value of this attribute unchanged (since this might link to a resource external to the application, the session identifier is not included.
  • page - Use the value of this attribute as an application-relative URI to the desired resource.
Attribute Name Description
anchor

Optional anchor tag ("#xxx") to be added to the generated hyperlink. Specify this value without any "#" character.

(RT EXPR)
forward

Logical name of a global ActionForward that contains the actual content-relative URI of the resource to be included.

(RT EXPR)
href

Absolute URL (including the appropriate protocol prefix such as "http:") of the resource to be included. Because this URL could be external to the current web application, the session identifier will not be included in the request.

(RT EXPR)
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.

(REQUIRED)
name

Application-relative name (starting with a '/') of the web application resource to be dispatched, and whose response data is to be made available as a bean. DEPRECATED - Use the "page" attribute instead.

(RT EXPR)
page

Application-relative URI (starting with a '/') of the web application resource to be included.

(RT EXPR)
transaction

Set to true if you want the current transaction control token included in the generated URL for this include.

(RT EXPR)


The Struts Framework Project - Bean Tags

message - Render an internationalized message string to the response.

Retrieves an internationalized message for the specified locale, using the specified message key, and write it to the output stream. Up to five parametric replacements (such as "{0}") may be specified.

The message key may be specified directly, using the key attribute, or indirectly, using the name and property attributes to obtain it from a bean.

JSTL: The equivalent JSTL tag is <fmt:message>. For example,
<fmt:message key="my.msg.key"> <fmt:param value="replacement text"/> </fmt:message>

Attribute Name Description
arg0

First parametric replacement value, if any.

(RT EXPR)
arg1

Second parametric replacement value, if any.

(RT EXPR)
arg2

Third parametric replacement value, if any.

(RT EXPR)
arg3

Fourth parametric replacement value, if any.

(RT EXPR)
arg4

Fifth parametric replacement value, if any.

(RT EXPR)
bundle

The name of the application scope bean under which the MessageResources object containing our messages is stored.

[Action.MESSAGES_KEY] (RT EXPR)
key

The message key of the requested message, which must have a corresponding value in the message resources. If not specified, the key is obtained from the name and property attributes.

(RT EXPR)
locale

The name of the session scope bean under which our currently selected Locale object is stored.

[Action.LOCALE_KEY] (RT EXPR)
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 used as the message resource key.

(RT EXPR)
property

Specifies the name of the property to be accessed on the bean specified by name. This value may be a simple, indexed, or nested property reference expression. If not specified, the value of the bean identified by name will itself be used as the message resource key.

(RT EXPR)
scope

Specifies the variable scope searched to retrieve the bean specified by name. If not specified, the default rules applied by PageContext.findAttribute() are applied.

(RT EXPR)


The Struts Framework Project - Bean Tags

page - Expose a specified item from the page context as a bean.

Retrieve the value of the specified item from the page context for this page, and define it as a scripting variable, and a page scope attribute accessible to the remainder of the current page.

If a problem occurs while retrieving the specified configuration object, a request time exception will be thrown.
Attribute Name 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.

(REQUIRED)
property

Name of the property from our page context to be retrieved and exposed. Must be one of application, config, request, response, or session.

(REQUIRED) (RT EXPR)


The Struts Framework Project - Bean Tags

parameter - Define a scripting variable based on the value(s) of the specified request parameter.

Retrieve the value of the specified request parameter (as a single value or multiple values, depending on the multiple attribute), and define the result as a page scope attribute of type String (if multiple is not specified) or String[] (if multiple is specified).

If no request parameter with the specified name can be located, and no default value is specified, a request time exception will be thrown.
Attribute Name 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.

(REQUIRED)
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.

(RT EXPR)
name

Specifies the name of the request parameter whose value, or values, is to be retrieved.

(REQUIRED) (RT EXPR)
value

The default parameter value to return if no parameter with the specified name was included in this request.

(RT EXPR)


The Struts Framework Project - Bean Tags

resource - Load a web application resource and make it available as a bean.

Retrieve the value of the specified web application resource, and make it available as either a InputStream or a String, depending on the value of the input attribute.

If a problem occurs while retrieving the specified resource, a request time exception will be thrown.
Attribute Name 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.

(REQUIRED)
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.

(RT EXPR)
name

Application-relative name (starting with a '/') of the web application resource to be loaded and made available.

(REQUIRED) (RT EXPR)


The Struts Framework Project - Bean Tags

size - Define a bean containing the number of elements in a Collection or Map.

Given a reference to an array, Collection or Map, creates a new bean, of type java.lang.Integer, whose value is the number of elements in that collection. You can specify the collection to be counted in any one of the following ways:

  • As a runtime expression specified as the value of the collection attribute.
  • As a JSP bean specified by the name attribute.
  • As the property, specified by the property attribute, of the JSP bean specified by the name attribute.
Attribute Name Description
collection

A runtime expression that evaluates to an array, a Collection, or a Map.

(RT EXPR)
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.

(REQUIRED)
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.

(RT EXPR)
property

The name of the property, of the bean specified by the name attribute, whose getter method will return the collection to be counted.

(RT EXPR)
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.

(RT EXPR)


The Struts Framework Project - Bean Tags

struts - Expose a named Struts internal configuration object as a bean.

Retrieve the value of the specified Struts internal configuration object, and define it as a scripting variable and as a page scope attribute accessible to the remainder of the current page. You must specify exactly one of the formBean, forward, and mapping attributes to select the configuration object to be exposed.

If a problem occurs while retrieving the specified configuration object, a request time exception will be thrown.
Attribute Name Description
formBean

Specifies the name of the Struts ActionFormBean definition object to be exposed.

(RT EXPR)
forward

Specifies the name of the global Struts ActionForward definition object to be exposed.

(RT EXPR)
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.

(REQUIRED)
mapping

Specifies the matching path of the Struts ActionMapping definition object to be exposed.

(RT EXPR)


The Struts Framework Project - Bean Tags

write - Render the value of the specified bean property to the current JspWriter.

Retrieve the value of the specified bean property, and render it to the current JspWriter as a String by the ways:

  • If format attribute exists then value will be formatted on base of format string from format attribute and default system locale.
  • If in resources exists format string for value data type (view format attribute description) then value will be formatted on base of format string from resources. Resources bundle and target locale can be specified with bundle and locale attributes. If nothing specified then default resource bundle and current user locale will be used.
  • If there is a PropertyEditor configured for the property value's class, the getAsText() method will be called.
  • Otherwise, the usual toString() conversions will be applied.

If a problem occurs while retrieving the specified bean property, a request time exception will be thrown.
Attribute Name Description
bundle

The name of the application scope bean under which the MessageResources object containing our messages is stored.

[Action.MESSAGES_KEY] (RT EXPR)
filter

If this attribute is set to true, the rendered property value will be filtered for characters that are sensitive in HTML, and any such characters will be replaced by their entity equivalents.

[true] (RT EXPR)
format

Specifies the format string to use to convert bean or property value to the String. If nothing specified, then default format string for value data type will be searched in message resources by according key.

(RT EXPR)
formatKey

Specifies the key to search format string in application resources.

(RT EXPR)
ignore

If this attribute is set to true, and the bean specified by the name and scope attributes does not exist, simply return without writing anything. If this attribute is set to false, a runtime exception to be thrown, consistent with the other tags in this tag library.

[false] (RT EXPR)
locale

The name of the session scope bean under which our currently selected Locale object is stored.

[Action.LOCALE_KEY] (RT EXPR)
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.

(REQUIRED) (RT EXPR)
property

Specifies the name of the property to be accessed on the bean specified by name. This value may be a simple, indexed, or nested property reference expression. If not specified, the bean identified by name will itself be rendered. If the specified property returns null, no output will be rendered.

(RT EXPR)
scope

Specifies the variable scope searched to retrieve the bean specified by name. If not specified, the default rules applied by PageContext.findAttribute() are applied.

(RT EXPR)


The Struts Framework Project - Logic Tags

Struts Logic Tags

This tag library contains tags that are useful in managing conditional generation of output text, looping over object collections for repetitive generation of output text, and application flow management.

For tags that do value comparisons (equal, greaterEqual, greaterThan, lessEqual, lessThan, notEqual), the following rules apply:

  • The specified value is examined. If it can be converted successfully to a double or a long, it is assumed that the ultimate comparison will be numeric (either floating point or integer). Otherwise, a String comparison will be performed.
  • The variable to be compared to is retrieved, based on the selector attribute(s) (cookie, header, name, parameter, property) present on this tag. It will be converted to the appropriate type for the comparison, as determined above.
  • If the specified variable or property returns null, it will be coerced to a zero-length string before the comparison occurs.
  • The specific comparison for this tag will be performed, and the nested body content of this tag will be evaluated if the comparison returns a true result.

For tags that do substring matching (match, notMatch), the following rules apply:

  • The specified variable is retrieved, based on the selector attribute(s) (cookie, header, name, parameter, property) present on this tag. The variable is converted to a String, if necessary.
  • A request time exception will be thrown if the specified variable cannot be retrieved, or has a null value.
  • The specified value is checked for existence as a substring of the variable, in the position specified by the location attribute, as follows: at the beginning (if location is set to start), at the end (if location is set to end), or anywhere (if location is not specified).

Many of the tags in this tag library will throw a JspException at runtime when they are utilized incorrectly (such as when you specify an invalid combination of tag attributes). JSP allows you to declare an "error page" in the <%@ page %> directive. If you wish to process the actual exception that caused the problem, it is passed to the error page as a request attribute under key org.apache.struts.action.EXCEPTION.
Tag Name | Description
empty | Evaluate the nested body content of this tag if the requested variable is either null or an empty string.
equal | Evaluate the nested body content of this tag if the requested variable is equal to the specified value.
forward | Forward control to the page specified by the specified ActionForward entry.
greaterEqual | Evaluate the nested body content of this tag if the requested variable is greater than or equal to the specified value.
greaterThan | Evaluate the nested body content of this tag if the requested variable is greater than the specified value.
iterate | Repeat the nested body content of this tag over a specified collection.
lessEqual | Evaluate the nested body content of this tag if the requested variable is greater than or equal to the specified value.
lessThan | Evaluate the nested body content of this tag if the requested variable is less than the specified value.
match | Evaluate the nested body content of this tag if the specified value is an appropriate substring of the requested variable.
messagesNotPresent | Generate the nested body content of this tag if the specified message is not present in this request.
messagesPresent | Generate the nested body content of this tag if the specified message is present in this request.
notEmpty | Evaluate the nested body content of this tag if the requested variable is neither null, nor an empty string, nor an empty java.util.Collection (tested by the .isEmpty() method on the java.util.Collection interface).
notEqual | Evaluate the nested body content of this tag if the requested variable is not equal to the specified value.
notMatch | Evaluate the nested body content of this tag if the specified value is not an appropriate substring of the requested variable.
notPresent | Generate the nested body content of this tag if the specified value is not present in this request.
present | Generate the nested body content of this tag if the specified value is present in this request.
redirect | Render an HTTP Redirect


The Struts Framework Project - Logic Tags

empty - Evaluate the nested body content of this tag if the requested variable is either null or an empty string.

Since: Struts 1.1

This tag evaluates its nested body content only if the specified value is either absent (i.e. null), an empty string (i.e. a java.lang.String with a length of zero), or an empty java.util.Collection or java.util.Map (tested by the .isEmpty() method on the respective interface).

JSTL: The equivalent JSTL tag is <c:if> using the empty operator. For example,
<c:if test="${empty sessionScope.myBean.myProperty}"> do something </c:if>

Attribute Name Description
name

The variable to be compared is the JSP bean specified by this attribute, if property is not specified, or the value of the specified property of this bean, if property is specified.

(RT EXPR)
property

The variable to be compared is the property (of the bean specified by the name attribute) specified by this attribute. The property reference can be simple, nested, and/or indexed.

(RT EXPR)
scope

The bean scope within which to search for the bean named by the name property, or "any scope" if not specified.

(RT EXPR)


The Struts Framework Project - Logic Tags

equal - Evaluate the nested body content of this tag if the requested variable is equal to the specified value.

Compares the variable specified by one of the selector attributes against the specified constant value. The nested body content of this tag is evaluated if the variable and value are equal.

Attribute Name Description
cookie

The variable to be compared is the value of the cookie whose name is specified by this attribute.

(RT EXPR)
header

The variable to be compared is the value of the header whose name is specified by this attribute. The name match is performed in a case insensitive manner.

(RT EXPR)
name

The variable to be compared is the JSP bean specified by this attribute, if property is not specified, or the value of the specified property of this bean, if property is specified.

(RT EXPR)
parameter

The variable to be compared is the first, or only, value of the request parameter specified by this attribute.

(RT EXPR)
property

The variable to be compared is the property (of the bean specified by the name attribute) specified by this attribute. The property reference can be simple, nested, and/or indexed.

(RT EXPR)
scope

The bean scope within which to search for the bean named by the name property, or "any scope" if not specified.

(RT EXPR)
value

The constant value to which the variable, specified by other attribute(s) of this tag, will be compared.

(REQUIRED) (RT EXPR)


The Struts Framework Project - Logic Tags

forward - Forward control to the page specified by the specified ActionForward entry.

Performs a PageContext.forward() or HttpServletResponse.sendRedirect() call for the global ActionForward entry for the specified name. URL rewriting will occur automatically if a redirect is performed.
Attribute Name Description
name

The logical name of the global ActionForward entry that identifies the destination, and forwarding approach, to be used. Note: forwarding to Tiles definitions is not supported from this tag. You should forward to them from an Action subclass.

(REQUIRED) (RT EXPR)


The Struts Framework Project - Logic Tags

greaterEqual - Evaluate the nested body content of this tag if the requested variable is greater than or equal to the specified value.

Compares the variable specified by one of the selector attributes against the specified constant value. The nested body content of this tag is evaluated if the variable is greater than or equal to the value.
Attribute Name Description
cookie

The variable to be compared is the value of the cookie whose name is specified by this attribute.

(RT EXPR)
header

The variable to be compared is the value of the header whose name is specified by this attribute. The name match is performed in a case insensitive manner.

(RT EXPR)
name

The variable to be compared is the JSP bean specified by this attribute, if property is not specified, or the value of the specified property of this bean, if property is specified.

(RT EXPR)
parameter

The variable to be compared is the first, or only, value of the request parameter specified by this attribute.

(RT EXPR)
property

The variable to be compared is the property (of the bean specified by the name attribute) specified by this attribute. The property reference can be simple, nested, and/or indexed.

(RT EXPR)
scope

The bean scope within which to search for the bean named by the name property, or "any scope" if not specified.

(RT EXPR)
value

The constant value to which the variable, specified by other attribute(s) of this tag, will be compared.

(REQUIRED) (RT EXPR)


The Struts Framework Project - Logic Tags

greaterThan - Evaluate the nested body content of this tag if the requested variable is greater than the specified value.

Compares the variable specified by one of the selector attributes against the specified constant value. The nested body content of this tag is evaluated if the variable is greater than the value.
Attribute Name Description
cookie

The variable to be compared is the value of the cookie whose name is specified by this attribute.

(RT EXPR)
header

The variable to be compared is the value of the header whose name is specified by this attribute. The name match is performed in a case insensitive manner.

(RT EXPR)
name

The variable to be compared is the JSP bean specified by this attribute, if property is not specified, or the value of the specified property of this bean, if property is specified.

(RT EXPR)
parameter

The variable to be compared is the first, or only, value of the request parameter specified by this attribute.

(RT EXPR)
property

The variable to be compared is the property (of the bean specified by the name attribute) specified by this attribute. The property reference can be simple, nested, or indexed.

(RT EXPR)
scope

The bean scope within which to search for the bean named by the name property, or "any scope" if not specified.

(RT EXPR)
value

The constant value to which the variable, specified by other attribute(s) of this tag, will be compared.

(REQUIRED) (RT EXPR)


The Struts Framework Project - Logic Tags

iterate - Repeat the nested body content of this tag over a specified collection.

Repeats the nested body content of this tag once for every element of the specified collection, which must be an Iterator, a Collection, a Map (whose values are to be iterated over), or an array. The collection to be iterated over must be specified in one of the following ways:

  • As a runtime expression specified as the value of the collection attribute.
  • As a JSP bean specified by the name attribute.
  • As the property, specified by the property, of the JSP bean specified by the name attribute.

The collection to be iterated over MUST conform to one of the following requirements in order for iteration to be successful:

  • An array of Java objects or primitives.
  • An implementation of java.util.Collection, including ArrayList and Vector.
  • An implementation of java.util.Enumeration.
  • An implementation of java.util.Iterator.
  • An implementation of java.util.Map, including HashMap, Hashtable, and TreeMap. NOTE - See below for additional information about accessing Maps.

Normally, each object exposed by the iterate tag is an element of the underlying collection you are iterating over. However, if you iterate over a Map, the exposed object is of type Map.Entry that has two properties:

  • key - The key under which this item is stored in the underlying Map.
  • value - The value that corresponds to this key.

So, if you wish to iterate over the values of a Hashtable, you would implement code like the following:

<logic:iterate id="element" name="myhashtable">
Next element is <bean:write name="element" property="value"/>
</logic:iterate>

If the collection you are iterating over can contain null values, the loop will still be performed but no page scope attribute (named by the id attribute) will be created for that loop iteration. You can use the <logic:present> and <logic:notPresent> tags to test for this case.
Attribute Name Description
collection

A runtime expression that evaluates to a collection (conforming to the requirements listed above) to be iterated over.

(RT EXPR)
id

The name of a page scope JSP bean that will contain the current element of the collection on each iteration, if it is not null.

(REQUIRED)
indexId

The name of a page scope JSP bean that will contain the current index of the collection on each iteration.
length

The maximum number of entries (from the underlying collection) to be iterated through on this page. This can be either an integer that directly expresses the desired value, or the name of a JSP bean (in any scope) of type java.lang.Integer that defines the desired value. If not present, there will be no limit on the number of iterations performed.

(RT EXPR)
name

The name of the JSP bean containing the collection to be iterated (if property is not specified), or the JSP bean whose property getter returns the collection to be iterated (if property is specified).

(RT EXPR)
offset

The zero-relative index of the starting point at which entries from the underlying collection will be iterated through. This can be either an integer that directly expresses the desired value, or the name of a JSP bean (in any scope) of type java.lang.Integer that defines the desired value. If not present, zero is assumed (meaning that the collection will be iterated from the beginning.

(RT EXPR)
property

Name of the property, of the JSP bean specified by name, whose getter returns the collection to be iterated.

(RT EXPR)
scope

The bean scope within which to search for the bean named by the name property, or "any scope" if not specified.

(RT EXPR)
type

Fully qualified Java class name of the element to be exposed through the JSP bean named from the id attribute. If not present, no type conversions will be performed. NOTE: The actual elements of the collection must be assignment-compatible with this class, or a request time ClassCastException will occur.

(RT EXPR)


The Struts Framework Project - Logic Tags

lessEqual - Evaluate the nested body content of this tag if the requested variable is greater than or equal to the specified value.

Compares the variable specified by one of the selector attributes against the specified constant value. The nested body content of this tag is evaluated if the variable is less than or equal to the value.
Attribute Name Description
cookie

The variable to be compared is the value of the cookie whose name is specified by this attribute.

(RT EXPR)
header

The variable to be compared is the value of the header whose name is specified by this attribute. The name match is performed in a case insensitive manner.

(RT EXPR)
name

The variable to be compared is the JSP bean specified by this attribute, if property is not specified, or the value of the specified property of this bean, if property is specified.

(RT EXPR)
parameter

The variable to be compared is the first, or only, value of the request parameter specified by this attribute.

(RT EXPR)
property

The variable to be compared is the property (of the bean specified by the name attribute) specified by this attribute. The property reference can be simple, nested, or indexed.

(RT EXPR)
scope

The bean scope within which to search for the bean named by the name property, or "any scope" if not specified.

(RT EXPR)
value

The constant value to which the variable, specified by other attribute(s) of this tag, will be compared.

(REQUIRED) (RT EXPR)


The Struts Framework Project - Logic Tags

lessThan - Evaluate the nested body content of this tag if the requested variable is less than the specified value.

Compares the variable specified by one of the selector attributes against the specified constant value. The nested body content of this tag is evaluated if the variable is less than the value.
Attribute Name Description
cookie

The variable to be compared is the value of the cookie whose name is specified by this attribute.

(RT EXPR)
header

The variable to be compared is the value of the header whose name is specified by this attribute. The name match is performed in a case insensitive manner.

(RT EXPR)
name

The variable to be compared is the JSP bean specified by this attribute, if property is not specified, or the value of the specified property of this bean, if property is specified.

(RT EXPR)
parameter

The variable to be compared is the first, or only, value of the request parameter specified by this attribute.

(RT EXPR)
property

The variable to be compared is the property (of the bean specified by the name attribute) specified by this attribute. The property reference can be simple, nested, and/or indexed.

(RT EXPR)
scope

The bean scope within which to search for the bean named by the name property, or "any scope" if not specified.

(RT EXPR)
value

The constant value to which the variable, specified by other attribute(s) of this tag, will be compared.

(REQUIRED) (RT EXPR)


The Struts Framework Project - Logic Tags

match - Evaluate the nested body content of this tag if the specified value is an appropriate substring of the requested variable.

Matches the variable specified by one of the selector attributes (as a String) against the specified constant value. If the value is a substring (appropriately limited by the location attribute), the nested body content of this tag is evaluated.
Attribute Name Description
cookie

The variable to be matched is the value of the cookie whose name is specified by this attribute.

(RT EXPR)
header

The variable to be matched is the value of the header whose name is specified by this attribute. The name match is performed in a case insensitive manner.

(RT EXPR)
location

If not specified, a match between the variable and the value may occur at any position within the variable string. If specified, the match must occur at the specified location (either start or end) of the variable string.

(RT EXPR)
name

The variable to be matched is the JSP bean specified by this attribute, if property is not specified, or the value of the specified property of this bean, if property is specified.

(RT EXPR)
parameter

The variable to be matched is the first, or only, value of the request parameter specified by this attribute.

(RT EXPR)
property

The variable to be matched is the property (of the bean specified by the name attribute) specified by this attribute. The property reference can be simple, nested, and/or indexed.

(RT EXPR)
scope

The bean scope within which to search for the bean named by the name property, or "any scope" if not specified.

(RT EXPR)
value

The constant value which is checked for existence as a substring of the specified variable.

(REQUIRED) (RT EXPR)


The Struts Framework Project - Logic Tags

messagesNotPresent - Generate the nested body content of this tag if the specified message is not present in this request.

Since: Struts 1.1

Evaluates the nested body content of this tag if an ActionMessages object, ActionErrors object, a String, or a String array is not in request scope. If such a bean is not found, nothing will be rendered.

Attribute Name Description
message

By default the tag will retrieve the request scope bean it will iterate over from the Action.ERROR_KEY constant string, but if this attribute is set to 'true' the request scope bean will be retrieved from the Action.MESSAGE_KEY constant string. Also if this is set to 'true', any value assigned to the name attribute will be ignored.

(RT EXPR)
name

The parameter key to retrieve the message from request scope.

(RT EXPR)
property

Name of the property for which messages should be retrieved. If not specified, all messages (regardless of property) are retrieved.

(RT EXPR)


The Struts Framework Project - Logic Tags

messagesPresent - Generate the nested body content of this tag if the specified message is present in this request.

Since: Struts 1.1

Evaluates the nested body content of this tag if an ActionMessages object, ActionErrors object, a String, or a String array is in request scope. If such a bean is not found, nothing will be rendered.

Attribute Name Description
message

By default the tag will retrieve the request scope bean it will iterate over from the Action.ERROR_KEY constant string, but if this attribute is set to 'true' the request scope bean will be retrieved from the Action.MESSAGE_KEY constant string. Also if this is set to 'true', any value assigned to the name attribute will be ignored.

(RT EXPR)
name

The parameter key to retrieve the message from request scope.

(RT EXPR)
property

Name of the property for which messages should be retrieved. If not specified, all messages (regardless of property) are retrieved.

(RT EXPR)


The Struts Framework Project - Logic Tags

notEmpty - Evaluate the nested body content of this tag if the requested variable is neither null, nor an empty string, nor an empty java.util.Collection (tested by the .isEmpty() method on the java.util.Collection interface).

This tag evaluates its nested body content only if the specified value is present (i.e. not null) and is not an empty string (i.e. a java.lang.String with a length of zero).

JSTL: The equivalent JSTL tag is <c:if> using the ! empty operator. For example,
<c:if test="${ ! empty sessionScope.myBean.myProperty}"> do something </c:if>

Attribute Name Description
name

The variable to be compared is the JSP bean specified by this attribute, if property is not specified, or the value of the specified property of this bean, if property is specified.

(RT EXPR)
property

The variable to be compared is the property (of the bean specified by the name attribute) specified by this attribute. The property reference can be simple, nested, and/or indexed.

(RT EXPR)
scope

The bean scope within which to search for the bean named by the name property, or "any scope" if not specified.

(RT EXPR)


The Struts Framework Project - Logic Tags

notEqual - Evaluate the nested body content of this tag if the requested variable is not equal to the specified value.

Compares the variable specified by one of the selector attributes against the specified constant value. The nested body content of this tag is evaluated if the variable and value are not equal.

Attribute Name Description
cookie

The variable to be compared is the value of the cookie whose name is specified by this attribute.

(RT EXPR)
header

The variable to be compared is the value of the header whose name is specified by this attribute. The name match is performed in a case insensitive manner.

(RT EXPR)
name

The variable to be compared is the JSP bean specified by this attribute, if property is not specified, or the value of the specified property of this bean, if property is specified.

(RT EXPR)
parameter

The variable to be compared is the first, or only, value of the request parameter specified by this attribute.

(RT EXPR)
property

The variable to be compared is the property (of the bean specified by the name attribute) specified by this attribute. The property reference can be simple, nested, and/or indexed.

(RT EXPR)
scope

The bean scope within which to search for the bean named by the name property, or "any scope" if not specified.

(RT EXPR)
value

The constant value to which the variable, specified by other attribute(s) of this tag, will be compared.

(REQUIRED) (RT EXPR)


The Struts Framework Project - Logic Tags

notMatch - Evaluate the nested body content of this tag if the specified value is not an appropriate substring of the requested variable.

Matches the variable specified by one of the selector attributes (as a String) against the specified constant value. If the value is not a substring (appropriately limited by the location attribute), the nested body content of this tag is evaluated.
Attribute Name Description
cookie

The variable to be matched is the value of the cookie whose name is specified by this attribute.

(RT EXPR)
header

The variable to be matched is the value of the header whose name is specified by this attribute. The name match is performed in a case insensitive manner.

(RT EXPR)
location

If not specified, a match between the variable and the value may occur at any position within the variable string. If specified, the match must occur at the specified location (either start or end) of the variable string.

(RT EXPR)
name

The variable to be matched is the JSP bean specified by this attribute, if property is not specified, or the value of the specified property of this bean, if property is specified.

(RT EXPR)
parameter

The variable to be matched is the first, or only, value of the request parameter specified by this attribute.

(RT EXPR)
property

The variable to be matched is the property (of the bean specified by the name attribute) specified by this attribute. The property reference can be simple, nested, and/or indexed.

(RT EXPR)
scope

The bean scope within which to search for the bean named by the name property, or "any scope" if not specified.

(RT EXPR)
value

The constant value which is checked for existence as a substring of the specified variable.

(REQUIRED) (RT EXPR)


The Struts Framework Project - Logic Tags

notPresent - Generate the nested body content of this tag if the specified value is not present in this request.

Depending on which attribute is specified, this tag checks the current request, and evaluates the nested body content of this tag only if the specified value is not present. Only one of the attributes may be used in one occurrence of this tag, unless you use the property attribute, in which case the name attribute is also required.
Attribute Name Description
cookie

Checks for the existence of a cookie with the specified name.

(RT EXPR)
header

Checks for the existence of an HTTP header with the specified name. The name match is performed in a case insensitive manner.

(RT EXPR)
name

Checks for the existence of a JSP bean, in any scope, with the specified name. If property is also specified, checks for a non-null property value for the specified property.

(RT EXPR)
parameter

Checks for the existence of at least one occurrence of the specified request parameter on this request, even if the parameter value is a zero-length string.

(RT EXPR)
property

Checks for the existence of a non-null property value, returned by a property getter method on the JSP bean (in any scope) that is specified by the name attribute. Property references can be simple, nested, and/or indexed.

(RT EXPR)
role

Checks whether the currently authenticated user (if any) has been associated with the specified security role.

(RT EXPR)
scope

The bean scope within which to search for the bean named by the name property, or "any scope" if not specified.

(RT EXPR)
user

Checks whether the currently authenticated user principal has the specified name.

(RT EXPR)


The Struts Framework Project - Logic Tags

present - Generate the nested body content of this tag if the specified value is present in this request.

Depending on which attribute is specified, this tag checks the current request, and evaluates the nested body content of this tag only if the specified value is present. Only one of the attributes may be used in one occurrence of this tag, unless you use the property attribute, in which case the name attribute is also required.
Attribute Name Description
cookie

Checks for the existence of a cookie with the specified name.

(RT EXPR)
header

Checks for the existence of an HTTP header with the specified name. The name match is performed in a case insensitive manner.

(RT EXPR)
name

Checks for the existence of a JSP bean, in any scope, with the specified name. If property is also specified, checks for a non-null property value for the specified property.

(RT EXPR)
parameter

Checks for the existence of at least one occurrence of the specified request parameter on this request, even if the parameter value is a zero-length string.

(RT EXPR)
property

Checks for the existence of a non-null property value, returned by a property getter method on the JSP bean (in any scope) that is specified by the name attribute. Property references can be simple, nested, and/or indexed.

(RT EXPR)
role

Checks whether the currently authenticated user (if any) has been associated with any of the specified security roles. Use a comma-delimited list to check for multiple roles. Example: <logic:present role="role1,role2,role3"> code..... </logic:present>

(RT EXPR)
scope

The bean scope within which to search for the bean named by the name property, or "any scope" if not specified.

(RT EXPR)
user

Checks whether the currently authenticated user principal has the specified name.

(RT EXPR)


The Struts Framework Project - Logic Tags

redirect - Render an HTTP Redirect

Performs an HttpServletResponse.sendRedirect() call to the hyperlink specified by the attributes to this tag. URL rewriting will be applied automatically, to maintain session state in the absence of cookies.

The base URL for this redirect is calculated based on which of the following attributes you specify (you must specify exactly one of them):

  • forward - Use the value of this attribute as the name of a global ActionForward to be looked up, and use the application-relative or context-relative URI found there.
  • href - Use the value of this attribute unchanged.
  • page - Use the value of this attribute as an application-relative URI, and generate a server-relative URI by including the context path.

Normally, the redirect you specify with one of the attributes described in the previous paragraph will be left unchanged (other than URL rewriting if necessary). However, there are two ways you can append one or more dynamically defined query parameters to the hyperlink -- specify a single parameter with the paramId attribute (and its associated attributes to select the value), or specify the name (and optional property) attributes to select a java.util.Map bean that contains one or more parameter ids and corresponding values.

To specify a single parameter, use the paramId attribute to define the name of the request parameter to be submitted. To specify the corresponding value, use one of the following approaches:

  • Specify only the paramName attribute - The named JSP bean (optionally scoped by the value of the paramScope attribute) must identify a value that can be converted to a String.
  • Specify both the paramName and paramProperty attributes - The specified property getter method will be called on the JSP bean identified by the paramName (and optional paramScope) attributes, in order to select a value that can be converted to a String.

If you prefer to specify a java.util.Map that contains all of the request parameters to be added to the hyperlink, use one of the following techniques:

  • Specify only the name attribute - The named JSP bean (optionally scoped by the value of the scope attribute) must identify a java.util.Map containing the parameters.
  • Specify both name and property attributes - The specified property getter method will be called on the bean identified by the name (and optional scope) attributes, in order to return the java.util.Map containing the parameters.

As the Map is processed, the keys are assumed to be the names of query parameters to be appended to the hyperlink. The value associated with each key must be either a String or a String array representing the parameter value(s). If a String array is specified, more than one value for the same query parameter name will be created.
Attribute Name Description
anchor

Optional anchor tag ("#xxx") to be added to the generated hyperlink. Specify this value without any "#" character.

(RT EXPR)
forward

Logical name of a global ActionForward that contains the actual content-relative URI of the destination of this redirect. This URI may be dynamically modified by the inclusion of query parameters, as described in the tag description. You must specify exactly one of the forward attribute, the href attribute, the linkName attribute, or the page attribute.

(RT EXPR)
href

The URL to which this redirect will transfer control. This URL may be dynamically modified by the inclusion of query parameters, as described in the tag description. You must specify exactly one of the forward attribute, the href attribute, the linkName attribute, or the page attribute.

(RT EXPR)
name

The name of a JSP bean that contains a Map representing the query parameters (if property is not specified), or a JSP bean whose property getter is called to return a Map (if property is specified).

(RT EXPR)
page

The context-relative path (beginning with a "/" character) to which this hyperlink will transfer control if activated. This hyperlink may be dynamically modified by the inclusion of query parameters, as described in the tag description. You must specify exactly one of the forward attribute, the href attribute, the linkName attribute, or the page attribute.

(RT EXPR)
paramId

The name of the request parameter that will be dynamically added to the generated hyperlink. The corresponding value is defined by the paramName and (optional) paramProperty attributes, optionally scoped by the paramScope attribute

(RT EXPR)
paramName

The name of a JSP bean that is a String containing the value for the request parameter named by paramId (if paramProperty is not specified), or a JSP bean whose property getter is called to return a String (if paramProperty is specified). The JSP bean is constrained to the bean scope specified by the paramScope property, if it is specified.

(RT EXPR)
paramProperty

The name of a property of the bean specified by the paramName attribute, whose return value must be a String containing the value of the request parameter (named by the paramId attribute) that will be dynamically added to this hyperlink.

(RT EXPR)
paramScope

The scope within which to search for the bean specified by the paramName attribute. If not specified, all scopes are searched.

(RT EXPR)
property

The name of a property of the bean specified by the name attribute, whose return value must be a java.util.Map containing the query parameters to be added to the hyperlink. You must specify the name attribute if you specify this attribute.

(RT EXPR)
scope

The scope within which to search for the bean specified by the name attribute. If not specified, all scopes are searched.

(RT EXPR)
transaction

Set to true if you want the current transaction control token included in the generated URL for this redirect.

(RT EXPR)


The Struts Framework Project - Bean Tags


The Struts Framework Project - HTML Tags

Page Construction Tags

This taglib contains tags used to create struts input forms, as well as other tags generally useful in the creation of HTML-based user interfaces.

Many of the tags in this tag library will throw a JspException at runtime when they are utilized incorrectly (such as when you specify an invalid combination of tag attributes). JSP allows you to declare an "error page" in the <%@ page %> directive. If you wish to process the actual exception that caused the problem, it is passed to the error page as a request attribute under key org.apache.struts.action.EXCEPTION.

Tag Name | Description
base | Render an HTML <base> Element
button | Render A Button Input Field
cancel | Render a Cancel Button
checkbox | Render A Checkbox Input Field
errors | Conditionally display a set of accumulated error messages.
file | Render A File Select Input Field
form | Define An Input Form
frame | Render an HTML frame element
hidden | Render A Hidden Field
html | Render an HTML <html> Element
image | Render an input tag of type "image"
img | Render an HTML img tag
javascript | Render JavaScript validation based on the validation rules loaded by the ValidatorPlugIn.
link | Render an HTML anchor or hyperlink
messages | Conditionally display a set of accumulated messages.
multibox | Render A Checkbox Input Field
option | Render A Select Option
options | Render a Collection of Select Options
optionsCollection | Render a Collection of Select Options
password | Render A Password Input Field
radio | Render A Radio Button Input Field
reset | Render A Reset Button Input Field
rewrite | Render an URI
select | Render A Select Element
submit | Render A Submit Button
text | Render An Input Field of Type text
textarea | Render A Textarea
xhtml | Render HTML tags as XHTML
base - Render an HTML <base> Element

Renders an HTML <base> element with an href attribute pointing to the absolute location of the enclosing JSP page. This tag is valid only when nested inside an HTML <head> element.

This tag is useful because it allows you to use relative URL references in the page that are calculated based on the URL of the page itself, rather than the URL to which the most recent submit took place (which is where the browser would normally resolve relative references against).

Attribute Name Description
server

The server name to use instead of request.getServerName().

(RT EXPR)
target

The window target for this base reference.

(RT EXPR)

Back to top

button - Render A Button Input Field

Renders an HTML <input> element of type button, populated from the specified value or the content of this tag body. This tag is only valid when nested inside a form tag body.

If a graphical button is needed (a button with an image), then the image tag is more appropriate.

Attribute Name | Description
accesskey | The keyboard character used to move focus immediately to this element. (RT EXPR)
alt

The alternate text for this element.

(RT EXPR)
altKey

The message resources key of the alternate text for this element.

(RT EXPR)
disabled | Set to true if this input field should be disabled. (RT EXPR)
indexed | Valid only inside of logic:iterate tag. If true then name of the html tag will be rendered as "propertyName[34]". Number in brackets will be generated for every iteration and taken from ancestor logic:iterate tag. (RT EXPR)
onblur | JavaScript event handler executed when this element loses input focus. (RT EXPR)
onchange | JavaScript event handler executed when this element loses input focus and its value has changed. (RT EXPR)
onclick | JavaScript event handler executed when this element receives a mouse click. (RT EXPR)
ondblclick | JavaScript event handler executed when this element receives a mouse double click. (RT EXPR)
onfocus | JavaScript event handler executed when this element receives input focus. (RT EXPR)
onkeydown | JavaScript event handler executed when this element has focus and a key is depressed. (RT EXPR)
onkeypress | JavaScript event handler executed when this element has focus and a key is depressed and released. (RT EXPR)
onkeyup | JavaScript event handler executed when this element has focus and a key is released. (RT EXPR)
onmousedown | JavaScript event handler executed when this element is under the mouse pointer and a mouse button is depressed. (RT EXPR)
onmousemove | JavaScript event handler executed when this element is under the mouse pointer and the pointer is moved. (RT EXPR)
onmouseout | JavaScript event handler executed when this element was under the mouse pointer but the pointer was moved outside the element. (RT EXPR)
onmouseover | JavaScript event handler executed when this element was not under the mouse pointer but the pointer is moved inside the element. (RT EXPR)
onmouseup | JavaScript event handler executed when this element is under the mouse pointer and a mouse button is released. (RT EXPR)
property | Name of the request parameter that will be included with this submission, set to the specified value. (REQUIRED) (RT EXPR)
style | CSS styles to be applied to this HTML element. (RT EXPR)
styleClass | CSS stylesheet class to be applied to this HTML element (renders a "class" attribute). (RT EXPR)
styleId | Identifier to be assigned to this HTML element (renders an "id" attribute). (RT EXPR)
tabindex | The tab order (ascending positive integers) for this element. (RT EXPR)
title

The advisory title for this element.

(RT EXPR)
titleKey

The message resources key for the advisory title for this element.

(RT EXPR)
value | Value of the label to be placed on this button. This value will also be submitted as the value of the specified request parameter. [Body of this tag (if any), or "Click"] (RT EXPR)

Back to top

cancel - Render a Cancel Button

Renders an HTML <input> element of type submit. This tag is only valid when nested inside a form tag body. Pressing of this submit button causes the action servlet to bypass calling the associated form bean validate() method. The action is called normally.

Attribute Name | Description
accesskey | The keyboard character used to move focus immediately to this element. (RT EXPR)
alt

The alternate text for this element.

(RT EXPR)
altKey

The message resources key of the alternate text for this element.

(RT EXPR)
disabled | Set to true if this input field should be disabled. (RT EXPR)
onblur | JavaScript event handler executed when this element loses input focus. (RT EXPR)
onchange | JavaScript event handler executed when this element loses input focus and its value has changed. (RT EXPR)
onclick | JavaScript event handler executed when this element receives a mouse click. (RT EXPR)
ondblclick | JavaScript event handler executed when this element receives a mouse double click. (RT EXPR)
onfocus | JavaScript event handler executed when this element receives input focus. (RT EXPR)
onkeydown | JavaScript event handler executed when this element has focus and a key is depressed. (RT EXPR)
onkeypress | JavaScript event handler executed when this element has focus and a key is depressed and released. (RT EXPR)
onkeyup | JavaScript event handler executed when this element has focus and a key is released. (RT EXPR)
onmousedown | JavaScript event handler executed when this element is under the mouse pointer and a mouse button is depressed. (RT EXPR)
onmousemove | JavaScript event handler executed when this element is under the mouse pointer and the pointer is moved. (RT EXPR)
onmouseout | JavaScript event handler executed when this element was under the mouse pointer but the pointer was moved outside the element. (RT EXPR)
onmouseover | JavaScript event handler executed when this element was not under the mouse pointer but the pointer is moved inside the element. (RT EXPR)
onmouseup | JavaScript event handler executed when this element is under the mouse pointer and a mouse button is released. (RT EXPR)
property | Name of the request parameter that will be included with this submission, set to the specified value. WARNING - If you set this attribute to a value other than the default, this will NOT be recognized as the cancel key by the Struts controller servlet or the Action.isCancelled() method. You will need to do your own cancel detection. (RT EXPR)
style | CSS styles to be applied to this HTML element. (RT EXPR)
styleClass | CSS stylesheet class to be applied to this HTML element (renders a "class" attribute). (RT EXPR)
styleId | Identifier to be assigned to this HTML element (renders an "id" attribute). (RT EXPR)
tabindex | The tab order (ascending positive integers) for this element. (RT EXPR)
title

The advisory title for this element.

(RT EXPR)
titleKey

The message resources key for the advisory title for this element.

(RT EXPR)
value | Value of the label to be placed on this button. This value will also be submitted as the value of the specified request parameter. [Body of this tag (if any), or "Cancel"] (RT EXPR)

Back to top

checkbox - Render A Checkbox Input Field

Renders an HTML <input> element of type checkbox, populated from the specified value or the specified property of the bean associated with our current form. This tag is only valid when nested inside a form tag body.

NOTE: The underlying property value associated with this field should be of type boolean, and any value you specify should correspond to one of the Strings that indicate a true value ("true", "yes", or "on"). If you wish to utilize a set of related String values, consider using the multibox tag.

WARNING: In order to correctly recognize unchecked checkboxes, the ActionForm bean associated with this form must include a statement setting the corresponding boolean property to false in the reset() method.

Attribute Name | Description
accesskey | The keyboard character used to move focus immediately to this element. (RT EXPR)
alt

The alternate text for this element.

(RT EXPR)
altKey

The message resources key of the alternate text for this element.

(RT EXPR)
disabled | Set to true if this input field should be disabled. (RT EXPR)
indexed | Valid only inside of logic:iterate tag. If true then name of the html tag will be rendered as "id[34].propertyName". Number in brackets will be generated for every iteration and taken from ancestor logic:iterate tag. (RT EXPR)
name | The attribute name of the bean whose properties are consulted when rendering the current value of this input field. If not specified, the bean associated with the form tag we are nested within is utilized. (RT EXPR)
onblur | JavaScript event handler executed when this element loses input focus. (RT EXPR)
onchange | JavaScript event handler executed when this element loses input focus and its value has changed. (RT EXPR)
onclick | JavaScript event handler executed when this element receives a mouse click. (RT EXPR)
ondblclick | JavaScript event handler executed when this element receives a mouse double click. (RT EXPR)
onfocus | JavaScript event handler executed when this element receives input focus. (RT EXPR)
onkeydown | JavaScript event handler executed when this element has focus and a key is depressed. (RT EXPR)
onkeypress | JavaScript event handler executed when this element has focus and a key is depressed and released. (RT EXPR)
onkeyup | JavaScript event handler executed when this element has focus and a key is released. (RT EXPR)
onmousedown | JavaScript event handler executed when this element is under the mouse pointer and a mouse button is depressed. (RT EXPR)
onmousemove | JavaScript event handler executed when this element is under the mouse pointer and the pointer is moved. (RT EXPR)
onmouseout | JavaScript event handler executed when this element was under the mouse pointer but the pointer was moved outside the element. (RT EXPR)
onmouseover | JavaScript event handler executed when this element was not under the mouse pointer but the pointer is moved inside the element. (RT EXPR)
onmouseup | JavaScript event handler executed when this element is under the mouse pointer and a mouse button is released. (RT EXPR)
property | Name of the request parameter that will be included with this submission, set to the specified value. (REQUIRED) (RT EXPR)
style | CSS styles to be applied to this HTML element. (RT EXPR)
styleClass | CSS stylesheet class to be applied to this HTML element (renders a "class" attribute). (RT EXPR)
styleId | Identifier to be assigned to this HTML element (renders an "id" attribute). (RT EXPR)
tabindex | The tab order (ascending positive integers) for this element. (RT EXPR)
title

The advisory title for this element.

(RT EXPR)
titleKey

The message resources key for the advisory title for this element.

(RT EXPR)
value | The value to be transmitted if this checkbox is checked when the form is submitted. If not specified, the value "on" will be returned. (RT EXPR)

Back to top

errors - Conditionally display a set of accumulated error messages.

Displays a set of error messages prepared by a business logic component and stored as an ActionErrors object, a String, or a String array in request scope. If such a bean is not found, nothing will be rendered.

In order to use this tag successfully, you must have defined an application scope MessageResources bean under the default attribute name, with optional definitions of the following message keys:

  • errors.header - Text that will be rendered before the error messages list. Typically, this message text will end with <ul> to start the error messages list.
  • errors.footer - Text that will be rendered after the error messages list. Typically, this message text will begin with </ul> to end the error messages list.
  • errors.prefix - Text that will be rendered before each individual error in the list.
  • errors.suffix - Text that will be rendered after each individual error in the list.
Attribute Name | Description
bundle | The servlet context attribute key for the MessageResources instance to use. If not specified, defaults to the application resources configured for our action servlet. (RT EXPR)
locale | The session attribute key for the Locale used to select messages to be displayed. If not specified, defaults to the Struts standard value. (RT EXPR)
name | Name of the request scope bean under which our error messages have been stored. If not present, the name specified by the Action.ERROR_KEY constant string will be used. (RT EXPR)
property | Name of the property for which error messages should be displayed. If not specified, all error messages (regardless of property) are displayed. (RT EXPR)

Back to top

file - Render A File Select Input Field

Renders an HTML <input> element of type file, defaulting to the specified value or the specified property of the bean associated with our current form. This tag is only valid when nested inside a form tag body.

As with the corresponding HTML <input> element, the enclosing form element must specify "POST" for the method attribute, and "multipart/form-data" for the enctype attribute. For example:

    <html:form method="POST" enctype="multipart/form-data">
        <html:file property="theFile" />
    </html:form>

Attribute Name | Description
accept | Comma-delimited set of content types that the server you submit to knows how to process. This list can be used by the client browser to limit the set of file options that is made available for selection. If not specified, no content type list will be sent. (RT EXPR)
accesskey | The keyboard character used to move focus immediately to this element. (RT EXPR)
alt

The alternate text for this element.

(RT EXPR)
altKey

The message resources key of the alternate text for this element.

(RT EXPR)
disabled | Set to true if this input field should be disabled. (RT EXPR)
indexed | Valid only inside of logic:iterate tag. If true then name of the html tag will be rendered as "id[34].propertyName". Number in brackets will be generated for every iteration and taken from ancestor logic:iterate tag. (RT EXPR)
maxlength | Maximum number of input characters to accept. This is ignored by most browsers. [No limit] (RT EXPR)
name | The attribute name of the bean whose properties are consulted when rendering the current value of this input field. If not specified, the bean associated with the form tag we are nested within is utilized. (RT EXPR)
onblur | JavaScript event handler executed when this element loses input focus. (RT EXPR)
onchange | JavaScript event handler executed when this element loses input focus and its value has changed. (RT EXPR)
onclick | JavaScript event handler executed when this element receives a mouse click. (RT EXPR)
ondblclick | JavaScript event handler executed when this element receives a mouse double click. (RT EXPR)
onfocus | JavaScript event handler executed when this element receives input focus. (RT EXPR)
onkeydown | JavaScript event handler executed when this element has focus and a key is depressed. (RT EXPR)
onkeypress | JavaScript event handler executed when this element has focus and a key is depressed and released. (RT EXPR)
onkeyup | JavaScript event handler executed when this element has focus and a key is released. (RT EXPR)
onmousedown | JavaScript event handler executed when this element is under the mouse pointer and a mouse button is depressed. (RT EXPR)
onmousemove | JavaScript event handler executed when this element is under the mouse pointer and the pointer is moved. (RT EXPR)
onmouseout | JavaScript event handler executed when this element was under the mouse pointer but the pointer was moved outside the element. (RT EXPR)
onmouseover | JavaScript event handler executed when this element was not under the mouse pointer but the pointer is moved inside the element. (RT EXPR)
onmouseup | JavaScript event handler executed when this element is under the mouse pointer and a mouse button is released. (RT EXPR)
property | Name of the request parameter that will be included with this submission, set to the specified value. (REQUIRED) (RT EXPR)
size | Size of the file selection box to be displayed. (RT EXPR)
style | CSS styles to be applied to this HTML element. (RT EXPR)
styleClass | CSS stylesheet class to be applied to this HTML element (renders a "class" attribute). (RT EXPR)
styleId | Identifier to be assigned to this HTML element (renders an "id" attribute). (RT EXPR)
tabindex | The tab order (ascending positive integers) for this element. (RT EXPR)
title

The advisory title for this element.

(RT EXPR)
titleKey

The message resources key for the advisory title for this element.

(RT EXPR)
value

NOTE: When setting this to some value, whether intentional or as the result (for example) of validation errors forcing the user back to the original jsp, this value is ignored by most browsers (for security reasons). This means that your users will have to re-select any previously selected files when submitting the form. Opera web browser will prompt the user so they have a chance to abort the submit.

Value to which this field should be initialized. [Use the corresponding bean property value or body content (if any) if property is not specified] (RT EXPR)

Back to top

form - Define An Input Form

Renders an HTML <form> element whose contents are described by the body content of this tag. The form implicitly interacts with the specified request scope or session scope bean to populate the input fields with the current property values from the bean.

The form bean is located, and created if necessary, based on the form bean specification for the associated ActionMapping.

Attribute Name | Description
action

The URL to which this form will be submitted. This value is also used to select the ActionMapping we are assumed to be processing, from which we can identify the appropriate form bean and scope.

If you are using extension mapping for selecting the controller servlet, this value should be equal to the path attribute of the corresponding <action> element, optionally followed by the correct extension suffix.

If you are using path mapping to select the controller servlet, this value should be exactly equal to the path attribute of the corresponding <action> element.

(REQUIRED) (RT EXPR)
enctype | The content encoding to be used to submit this form, if the method is POST. This must be set to "multipart/form-data" if you are using the file tag to enable file upload. If not specified, the browser default (normally "application/x-www-form-urlencoded") is used. (RT EXPR)
focus | The field name (among the fields on this form) to which initial focus will be assigned with a JavaScript function. If not specified, no special JavaScript for this purpose will be rendered. (RT EXPR)
focusIndex

Since: Struts 1.1

If the focus field is a field array, such as a radio button group, you can specify the index in the array to receive focus. (RT EXPR)
method | The HTTP method that will be used to submit this request (GET, POST). [POST] (RT EXPR)
onreset | JavaScript event handler executed if the form is reset. (RT EXPR)
onsubmit | JavaScript event handler executed if the form is submitted. (RT EXPR)
scriptLanguage

Since: Struts 1.2

The form's focus <script> element will not contain a language attribute when this is set to false. The default is true but this property is ignored in XHMTL mode. (RT EXPR)
style | CSS styles to be applied to this HTML element. (RT EXPR)
styleClass | CSS stylesheet class to be applied to this HTML element (renders a "class" attribute). (RT EXPR)
styleId | Identifier to be assigned to this HTML element (renders an "id" attribute). (RT EXPR)
target | Window target to which this form is submitted, such as for use in framed presentations. (RT EXPR)

Back to top

frame - Render an HTML frame element

Renders an HTML <frame> element with processing for the src attribute that is identical to that performed by the <html:link> tag for the href attribute. URL rewriting will be applied automatically, to maintain session state in the absence of cookies.

The base URL for this frame is calculated based on which of the following attributes you specify (you must specify exactly one of them):

  • forward - Use the value of this attribute as the name of a global ActionForward to be looked up, and use the application-relative or context-relative URI found there.
  • href - Use the value of this attribute unchanged.
  • page - Use the value of this attribute as a application-relative URI, and generate a server-relative URI by including the context path and application prefix.
  • action - Use the value of this attribute as the logical name of a global Action that contains the actual content-relative URI of the destination of this transfer.

Normally, the hyperlink you specify with one of the attributes described in the previous paragraph will be left unchanged (other than URL rewriting if necessary). However, there are two ways you can append one or more dynamically defined query parameters to the hyperlink -- specify a single parameter with the paramId attribute (and its associated attributes to select the value), or specify the name (and optional property) attributes to select a java.util.Map bean that contains one or more parameter ids and corresponding values.

To specify a single parameter, use the paramId attribute to define the name of the request parameter to be submitted. To specify the corresponding value, use one of the following approaches:

  • Specify only the paramName attribute - The named JSP bean (optionally scoped by the value of the paramScope attribute) must identify a value that can be converted to a String.
  • Specify both the paramName and paramProperty attributes - The specified property getter method will be called on the JSP bean identified by the paramName (and optional paramScope) attributes, in order to select a value that can be converted to a String.

If you prefer to specify a java.util.Map that contains all of the request parameters to be added to the hyperlink, use one of the following techniques:

  • Specify only the name attribute - The named JSP bean (optionally scoped by the value of the scope attribute) must identify a java.util.Map containing the parameters.
  • Specify both name and property attributes - The specified property getter method will be called on the bean identified by the name (and optional scope) attributes, in order to return the java.util.Map containing the parameters.

As the Map is processed, the keys are assumed to be the names of query parameters to be appended to the hyperlink. The value associated with each key must be either a String or a String array representing the parameter value(s), or an object whose toString() method will be called. If a String array is specified, more than one value for the same query parameter name will be created.

Additionally, you can request that the current transaction control token, if any, be included in the generated hyperlink by setting the transaction attribute to true. You can also request that an anchor ("#xxx") be added to the end of the URL that is created by any of the above mechanisms, by using the anchor attribute.

Attribute Name | Description
action

Logical name of a global Action that contains the actual content-relative URI of the destination of this transfer. This hyperlink may be dynamically modified by the inclusion of query parameters, as described in the tag description. You must specify exactly one of the action attribute, the forward attribute, the href attribute, or the page attribute.

(RT EXPR)
anchor

Optional anchor tag ("#xxx") to be added to the generated hyperlink. Specify this value without any "#" character.

(RT EXPR)
forward

Logical name of a global ActionForward that contains the actual content-relative URI of the destination of this transfer. This hyperlink may be dynamically modified by the inclusion of query parameters, as described in the tag description. You must specify exactly one of the action attribute, the forward attribute, the href attribute, or the page attribute.

(RT EXPR)
frameborder

Should a frame border be generated around this frame (1) or not (0)?

(RT EXPR)
frameName

Value for the name attribute of the rendered <frame> element.

(RT EXPR)
href

The URL to which this hyperlink will transfer control if activated. This hyperlink may be dynamically modified by the inclusion of query parameters, as described in the tag description. You must specify exactly one of the action attribute, the forward attribute, the href attribute, or the page attribute.

(RT EXPR)
longdesc

URI of a long description of the frame. This description should supplement the short description provided by the title attribute, and may be particularly useful for non-visual user agents.

(RT EXPR)
marginheight

The amount of space (in pixels) to be left between the frame's contents and its top and bottom margins.

(RT EXPR)
marginwidth

The amount of space (in pixels) to be left between the frame's contents and its left and right margins.

(RT EXPR)
name

The name of a JSP bean that contains a Map representing the query parameters (if property is not specified), or a JSP bean whose property getter is called to return a Map (if property is specified).

(RT EXPR)
noresize

Should users be disallowed from resizing the frame? (true, false).

(RT EXPR)
page

The module-relative path (beginning with a "/" character) to which this hyperlink will transfer control if activated. This hyperlink may be dynamically modified by the inclusion of query parameters, as described in the tag description. You must specify exactly one of the action attribute, the forward attribute, the href attribute, or the page attribute.

(RT EXPR)
paramId

The name of the request parameter that will be dynamically added to the generated hyperlink. The corresponding value is defined by the paramName and (optional) paramProperty attributes, optionally scoped by the paramScope attribute

(RT EXPR)
paramName

The name of a JSP bean that is a String containing the value for the request parameter named by paramId (if paramProperty is not specified), or a JSP bean whose property getter is called to return a String (if paramProperty is specified). The JSP bean is constrained to the bean scope specified by the paramScope property, if it is specified.

(RT EXPR)
paramProperty

The name of a property of the bean specified by the paramName attribute, whose return value must be a String containing the value of the request parameter (named by the paramId attribute) that will be dynamically added to this hyperlink.

(RT EXPR)
paramScope

The scope within which to search for the bean specified by the paramName attribute. If not specified, all scopes are searched.

(RT EXPR)
property

The name of a property of the bean specified by the name attribute, whose return value must be a java.util.Map containing the query parameters to be added to the hyperlink. You must specify the name attribute if you specify this attribute.

(RT EXPR)
scope

The scope within which to search for the bean specified by the name attribute. If not specified, all scopes are searched.

(RT EXPR)
scrolling

Should scroll bars be created unconditionally (yes), never (no), or only when needed (auto)?

(RT EXPR)
style

CSS styles to be applied to this element.

(RT EXPR)
styleClass | CSS stylesheet class to be applied to this HTML element (renders a "class" attribute). (RT EXPR)
styleId | Identifier to be assigned to this HTML element (renders an "id" attribute). (RT EXPR)
title

The advisory title for this element.

(RT EXPR)
titleKey

The message resources key for the advisory title for this element.

(RT EXPR)
transaction

If set to true, any current transaction control token will be included in the generated hyperlink, so that it will pass an isTokenValid() test in the receiving Action.

(RT EXPR)

Back to top

hidden - Render A Hidden Field

Renders an HTML <input> element of type hidden, populated from the specified value or the specified property of the bean associated with our current form. This tag is only valid when nested inside a form tag body.

Attribute Name | Description
accesskey | The keyboard character used to move focus immediately to this element. (RT EXPR)
alt

The alternate text for this element.

(RT EXPR)
altKey

The message resources key of the alternate text for this element.

(RT EXPR)
indexed | Valid only inside of logic:iterate tag. If true then name of the html tag will be rendered as "id[34].propertyName". Number in brackets will be generated for every iteration and taken from ancestor logic:iterate tag. (RT EXPR)
name | The attribute name of the bean whose properties are consulted when rendering the current value of this input field. If not specified, the bean associated with the form tag we are nested within is utilized. (RT EXPR)
onblur | JavaScript event handler executed when this element loses input focus. (RT EXPR)
onchange | JavaScript event handler executed when this element loses input focus and its value has changed. (RT EXPR)
onclick | JavaScript event handler executed when this element receives a mouse click. (RT EXPR)
ondblclick | JavaScript event handler executed when this element receives a mouse double click. (RT EXPR)
onfocus | JavaScript event handler executed when this element receives input focus. (RT EXPR)
onkeydown | JavaScript event handler executed when this element has focus and a key is depressed. (RT EXPR)
onkeypress | JavaScript event handler executed when this element has focus and a key is depressed and released. (RT EXPR)
onkeyup | JavaScript event handler executed when this element has focus and a key is released. (RT EXPR)
onmousedown | JavaScript event handler executed when this element is under the mouse pointer and a mouse button is depressed. (RT EXPR)
onmousemove | JavaScript event handler executed when this element is under the mouse pointer and the pointer is moved. (RT EXPR)
onmouseout | JavaScript event handler executed when this element was under the mouse pointer but the pointer was moved outside the element. (RT EXPR)
onmouseover | JavaScript event handler executed when this element was not under the mouse pointer but the pointer is moved inside the element. (RT EXPR)
onmouseup | JavaScript event handler executed when this element is under the mouse pointer and a mouse button is released. (RT EXPR)
property | Name of this input field, and the name of the corresponding bean property if value is not specified. The corresponding bean property (if any) must be of type String. (REQUIRED) (RT EXPR)
style | CSS styles to be applied to this HTML element. (RT EXPR)
styleClass | CSS stylesheet class to be applied to this HTML element (renders a "class" attribute). (RT EXPR)
styleId | Identifier to be assigned to this HTML element (renders an "id" attribute). (RT EXPR)
title

The advisory title for this element.

(RT EXPR)
titleKey

The message resources key for the advisory title for this element.

(RT EXPR)
value | Value to which this field should be initialized. [Use the corresponding bean property value] (RT EXPR)
write | Should the value of this field also be rendered to the response page to make it visible, in addition to creating an HTML type="hidden" element? By default, only the hidden element is created. (RT EXPR)

Back to top

html - Render an HTML <html> Element

Renders an HTML <html> element with language attributes extracted from the user's current Locale object, if there is one.

Attribute Name Description
lang

Since: Struts 1.2

Renders a lang attribute with the locale stored in the user's session. If not found in the session, the language from the Accept-Language HTTP header is used. If still not found, the default language for the server is used. (RT EXPR)
locale

DEPRECATED: Creating a session is undesirable for apps that don't support them. Use the lang attribute to acheive the same functionality without creating a session.

Set to true in order to store a Locale in the session based on the current request's Accept-Language header (if any) if none has currently been set. This attribute will create a session if one does not already exist. The lang attribute is rendered with the appropriate language code.

(RT EXPR)
xhtml

Since: Struts 1.1

Set to true in order to render xml:lang and xmlns attributes on the generated html element. This also causes all other html tags to render as xhtml.

(RT EXPR)

Back to top

image - Render an input tag of type "image"

Renders an HTML <input> tag of type "image". The base URL for this image is calculated directly based on the value specified in the src or page attributes, or indirectly by looking up a message resource string based on the srcKey or pageKey attributes. You must specify exactly one of these attributes.

If you would like to obtain the coordinates of the mouse click that submitted this request, see the information below on the property attribute.

This tag is only valid when nested inside a form tag body.

Attribute Name | Description
accesskey

The keyboard character used to move focus immediately to this element.

(RT EXPR)
align

The alignment option for this image.

The alignment option for this image. The align attribute is deprecated in HTML 4.x. The suggested alternative is to use CSS. Please see http://www.w3.org/TR/REC-html40/struct/objects.html#h-13.7.4 for more details.

(RT EXPR)
alt

The alternate text for this image.

(RT EXPR)
altKey

The message resources key of the alternate text for this image.

(RT EXPR)
border

The width (in pixels) of the border around this image.

(RT EXPR)
bundle

The servlet context attribute key for the MessageResources instance to use. If not specified, defaults to the application resources configured for our action servlet.

(RT EXPR)
disabled | Set to true if this input field should be disabled. (RT EXPR)
indexed | Valid only inside of logic:iterate tag. If true then name of the html tag will be rendered as "propertyName[34]". Number in brackets will be generated for every iteration and taken from ancestor logic:iterate tag. (RT EXPR)
locale

The session attribute key for the Locale used to select internationalized messages. If not specified, defaults to the Struts standard value.

(RT EXPR)
onblur | JavaScript event handler executed when this element loses input focus. (RT EXPR)
onchange | JavaScript event handler executed when this element loses input focus and its value has changed. (RT EXPR)
onclick | JavaScript event handler executed when this element receives a mouse click. (RT EXPR)
ondblclick | JavaScript event handler executed when this element receives a mouse double click. (RT EXPR)
onfocus | JavaScript event handler executed when this element receives input focus. (RT EXPR)
onkeydown | JavaScript event handler executed when this element has focus and a key is depressed. (RT EXPR)
onkeypress | JavaScript event handler executed when this element has focus and a key is depressed and released. (RT EXPR)
onkeyup | JavaScript event handler executed when this element has focus and a key is released. (RT EXPR)
onmousedown | JavaScript event handler executed when this element is under the mouse pointer and a mouse button is depressed. (RT EXPR)
onmousemove | JavaScript event handler executed when this element is under the mouse pointer and the pointer is moved. (RT EXPR)
onmouseout | JavaScript event handler executed when this element was under the mouse pointer but the pointer was moved outside the element. (RT EXPR)
onmouseover | JavaScript event handler executed when this element was not under the mouse pointer but the pointer is moved inside the element. (RT EXPR)
onmouseup | JavaScript event handler executed when this element is under the mouse pointer and a mouse button is released. (RT EXPR)
page

The module-relative path of the image for this input tag.

(RT EXPR)
pageKey

The key of the message resources string specifying the module-relative path of the image for this input tag.

(RT EXPR)
property

The property name of this image tag. The parameter names for the request will appear as "property.x" and "property.y", the x and y representing the coordinates of the mouse click for the image. A way of retrieving these values through a form bean is to define getX(), getY(), setX(), and setY() methods, and specify your property as a blank string (property="").

(RT EXPR)
src

The source URL of the image for this input tag.

(RT EXPR)
srcKey

The key of the message resources string specifying the source URL of the image for this input tag.

(RT EXPR)
style | CSS styles to be applied to this HTML element. (RT EXPR)
styleClass | CSS stylesheet class to be applied to this HTML element (renders a "class" attribute). (RT EXPR)
styleId | Identifier to be assigned to this HTML element (renders an "id" attribute). (RT EXPR)
tabindex | The tab order (ascending positive integers) for this element. (RT EXPR)
title

The advisory title for this element.

(RT EXPR)
titleKey

The message resources key for the advisory title for this element.

(RT EXPR)
value

The value that will be submitted if this image button is pressed.

(RT EXPR)

Back to top

img - Render an HTML img tag

Renders an HTML <img> element with the image at the specified URL. Like the link tag, URL rewriting will be applied automatically to the value specified in src or page, to maintain session state in the absence of cookies. This will allow dynamic generation of an image where the content displayed for this image will be taken from the attributes of this tag.

The base URL for this image is calculated directly based on the value specified in src or page, or indirectly by looking up a message resource string based on the srcKey or pageKey attributes. You must specify exactly one of these attributes.

Normally, the src or page that you specify will be left unchanged (other than URL rewriting if necessary). However, there are two ways you can append one or more dynamically defined query parameters to the src URL -- specify a single parameter with the paramId attribute (at its associated attributes to select the value), or specify the name (and optional property) attributes to select a java.util.Map bean that contains one or more parameter ids and corresponding values.

To specify a single parameter, use the paramId attribute to define the name of the request parameter to be submitted. To specify the corresponding value, use one of the following approaches:

  • Specify only the paramName attribute - The named JSP bean (optionally scoped by the value of the paramScope attribute) must identify a value that can be converted to a String.
  • Specify both the paramName and paramProperty attributes - The specified property getter will be called on the JSP bean identified by the paramName (and optional paramScope) attributes, in order to select a value that can be converted to a String.

If you prefer to specify a java.util.Map that contains all of the request parameters to be added to the hyperlink, use one of the following techniques:

  • Specify only the name attribute - The named JSP bean (optionally scoped by the value of the scope attribute) must identify a java.util.Map containing the parameters.
  • Specify both name and property attributes - The specified property getter method will be called on the bean identified by the name (and optional scope) attributes, in order to return the java.util.Map containing the parameters.

As the Map is processed, the keys are assumed to be the names of query parameters to be appended to the src URL. The value associated with each key must be either a String or a String array representing the parameter value(s), or an object whose toString() method will be called. If a String array is specified, more than one value for the same query parameter name will be created.

You can specify the alternate text for this image (which most browsers display as pop-up text block when the user hovers the mouse over this image) either directly, through the alt attribute, or indirectly from a message resources bundle, using the bundle and altKey attributes.

Attribute Name | Description
align

Where the image is aligned to. Can be one of the following attributes:

  • left - left justify, wrapping text on right
  • right -right justify, wrapping test on left
  • top - aligns the image with the top of the text on the same row
  • middle - aligns the image's vertical center with the text base line
  • bottom - aligns the image with the bottom of the text's base line
  • texttop - aligns the image's top with that of the text font on the same line
  • absmiddle - aligns the image's vertical center with the absolute center of the text
  • absbottom - aligns the image with the absolute bottom of the text font on the same row
(RT EXPR)
alt

And alternative text to be displayed in browsers that don't support graphics. Also used often as type of context help over images.

(RT EXPR)
altKey

The message resources key of the alternate text for this element.

(RT EXPR)
border

The width of the border surrounding the image.

(RT EXPR)
bundle

The servlet context attribute key for the MessageResources instance to use. If not specified, defaults to the application resources configured for our action servlet.

(RT EXPR)
height

The height of the image being displayed. This parameter is very nice to specify (along with width) to help the browser render the page faster.

(RT EXPR)
hspace

The amount of horizontal spacing between the icon and the text. The text may be in the same paragraph, or be wrapped around the image.

(RT EXPR)
imageName

The scriptable name to be defined within this page, so that you can reference it with intra-page scripts. In other words, the value specified here will render a "name" element in the generated image tag.

(RT EXPR)
ismap

The name of the server-side map that this image belongs to.

(RT EXPR)
locale

The name of the request or session Locale attribute used to look up internationalized messages.

(RT EXPR)
lowsrc

DEPRECATED - This attribute is not defined in the HTML 4.01 spec and will be removed in a future version of Struts. An image for people with low resolution graphics cards.

(RT EXPR)
name

The name of a JSP bean that contains a Map representing the query parameters (if property is not specified), or a JSP bean whose property getter is called to return a Map (if property is specified).

(RT EXPR)
onclick | JavaScript event handler executed when this element receives a mouse click. (RT EXPR)
ondblclick | JavaScript event handler executed when this element receives a mouse double click. (RT EXPR)
onkeydown

JavaScript event handler that is executed when this element receives a key down event.

(RT EXPR)
onkeypress

JavaScript event handler that is executed when this element receives a key press event.

(RT EXPR)
onkeyup

JavaScript event handler that is executed when this element receives a key up event.

(RT EXPR)
onmousedown | JavaScript event handler executed when this element is under the mouse pointer and a mouse button is depressed. (RT EXPR)
onmousemove | JavaScript event handler executed when this element is under the mouse pointer and the pointer is moved. (RT EXPR)
onmouseout | JavaScript event handler executed when this element was under the mouse pointer but the pointer was moved outside the element. (RT EXPR)
onmouseover | JavaScript event handler executed when this element was not under the mouse pointer but the pointer is moved inside the element. (RT EXPR)
onmouseup | JavaScript event handler executed when this element is under the mouse pointer and a mouse button is released. (RT EXPR)
page

The module-relative path, starting with a slash, of the image to be displayed by this tag. The rendered URL for this image will automatically prepend the context path of this web application (in the same manner as the page attribute on the link tag works), in addition to any necessary URL rewriting. You must specify either the page attribute or the src attribute.

(RT EXPR)
pageKey

The message key, in the message resources bundle named by the bundle attribute, of the String to be used as the module-relative path for this image.

(RT EXPR)
paramId

The name of the request parameter that will be dynamically added to the generated src URL. The corresponding value is defined by the paramName and (optional) paramProperty attributes, optionally scoped by the paramScope attribute

(RT EXPR)
paramName

The name of a JSP bean that is a String containing the value for the request parameter named by paramId (if paramProperty is not specified), or a JSP bean whose property getter is called to return a String (if paramProperty is specified). The JSP bean is constrained to the bean scope specified by the paramScope property, if it is specified.

(RT EXPR)
paramProperty

The name of a property of the bean specified by the paramName attribute, whose return value must be a String containing the value of the request parameter (named by the paramId attribute) that will be dynamically added to this src URL.

(RT EXPR)
paramScope

The scope within which to search for the bean specified by the paramName attribute. If not specified, all scopes are searched.

(RT EXPR)
property

The name of a property of the bean specified by the name attribute, whose return value must be a java.util.Map containing the query parameters to be added to the src URL. You must specify the name attribute if you specify this attribute.

(RT EXPR)
scope

The scope within which to search for the bean specified by the name attribute. If not specified, all scopes are searched.

(RT EXPR)
src

The URL to which this image will be transferred from This image may be dynamically modified by the inclusion of query parameters, as described in the tag description. This value will be used unmodified (other than potential URL rewriting) as the value of the "src" attribute in the rendered tag. You must specify either the page attribute or the src attribute.

(RT EXPR)
srcKey

The message key, in the message resources bundle named by the bundle attribute, of the String to be used as the URL of this image.

(RT EXPR)
style

CSS styles to be applied to this element.

(RT EXPR)
styleClass | CSS stylesheet class to be applied to this HTML element (renders a "class" attribute). (RT EXPR)
styleId | Identifier to be assigned to this HTML element (renders an "id" attribute). (RT EXPR)
title

The advisory title for this element.

(RT EXPR)
titleKey

The message resources key for the advisory title for this element.

(RT EXPR)
usemap

The name of the map as defined within this page for mapping hot-spot areas of this image.

(RT EXPR)
vspace

The amount of vertical spacing between the icon and the text, above and below.

(RT EXPR)
width

The width of the image being displayed. This parameter is very nice to specify (along with height) to help the browser render the page faster.

(RT EXPR)

Back to top

javascript - Render JavaScript validation based on the validation rules loaded by the ValidatorPlugIn.

Render JavaScript validation based on the validation rules loaded by the ValidatorPlugIn. The set of validation rules that should be generated is based on the formName attribute passed in, which should match the name attribute of the form element in the xml file.

The dynamicJavascript and staticJavascript attributes default to true, but if dynamicJavascript is set to true and staticJavascript is set to false then only the dynamic JavaScript will be rendered. If dynamicJavascript is set to false and staticJavascript is set to true then only the static JavaScript will be rendered which can then be put in separate JSP page so the browser can cache the static JavaScript.

Attribute Name Description
cdata

Since: Struts 1.1

If set to "true" and XHTML has been enabled, the JavaScript will be wrapped in a CDATA section to prevent XML parsing. The default is "true" to comply with the W3C's recommendation.

(RT EXPR)
dynamicJavascript

Whether or not to render the dynamic JavaScript. Defaults to true.

formName

The key (form name) to retrieve a specific set of validation rules.

(RT EXPR)
htmlComment

Whether or not to enclose the javascript with HTML comments. This attribute is ignored in XHTML mode because the script would be deleted by the XML parser. See the cdata attribute for details on hiding scripts from XML parsers. Defaults to true.

(RT EXPR)
method

The alternate JavaScript method name to be used instead of the of the default. The default is 'validate' concatenated in front of the key (form name) passed in (ex: validateRegistrationForm).

(RT EXPR)
page

The current page of a set of validation rules if the page attribute for the field element in the xml file is in use.

(RT EXPR)
scriptLanguage

Since: Struts 1.2

The <script> element will not contain a language attribute when this is set to false. The default is true but this property is ignored in XHMTL mode. (RT EXPR)
src

The src attribute's value when defining the html script element.

(RT EXPR)
staticJavascript

Whether or not to render the static JavaScript. Defaults to true.

Back to top

link - Render an HTML anchor or hyperlink

Renders an HTML <a> element as an anchor definition (if "linkName" is specified) or as a hyperlink to the specified URL. URL rewriting will be applied automatically, to maintain session state in the absence of cookies. The content displayed for this hyperlink will be taken from the body of this tag.

The base URL for this hyperlink is calculated based on which of the following attributes you specify (you must specify exactly one of them):

  • forward - Use the value of this attribute as the name of a global ActionForward to be looked up, and use the application-relative or context-relative URI found there.
  • action - Use the value of this attribute as the name of a Action to be looked up, and use the application-relative or context-relative URI found there.
  • href - Use the value of this attribute unchanged.
  • page - Use the value of this attribute as a application-relative URI, and generate a server-relative URI by including the context path and application prefix.

Normally, the hyperlink you specify with one of the attributes described in the previous paragraph will be left unchanged (other than URL rewriting if necessary). However, there are two ways you can append one or more dynamically defined query parameters to the hyperlink -- specify a single parameter with the paramId attribute (and its associated attributes to select the value), or specify the name (and optional property) attributes to select a java.util.Map bean that contains one or more parameter ids and corresponding values.

To specify a single parameter, use the paramId attribute to define the name of the request parameter to be submitted. To specify the corresponding value, use one of the following approaches:

  • Specify only the paramName attribute - The named JSP bean (optionally scoped by the value of the paramScope attribute) must identify a value that can be converted to a String.
  • Specify both the paramName and paramProperty attributes - The specified property getter method will be called on the JSP bean identified by the paramName (and optional paramScope) attributes, in order to select a value that can be converted to a String.

If you prefer to specify a java.util.Map that contains all of the request parameters to be added to the hyperlink, use one of the following techniques:

  • Specify only the name attribute - The named JSP bean (optionally scoped by the value of the scope attribute) must identify a java.util.Map containing the parameters.
  • Specify both name and property attributes - The specified property getter method will be called on the bean identified by the name (and optional scope) attributes, in order to return the java.util.Map containing the parameters.

As the Map is processed, the keys are assumed to be the names of query parameters to be appended to the hyperlink. The value associated with each key must be either a String or a String array representing the parameter value(s), or an object whose toString() method will be called. If a String array is specified, more than one value for the same query parameter name will be created.

Additionally, you can request that the current transaction control token, if any, be included in the generated hyperlink by setting the transaction attribute to true. You can also request that an anchor ("#xxx") be added to the end of the URL that is created by any of the above mechanisms, by using the anchor attribute.

Attribute Name | Description
accesskey

The keyboard character used to move focus immediately to this element.

(RT EXPR)
action

Logical name of a Action that contains the actual content-relative URI of the destination of this transfer. This hyperlink may be dynamically modified by the inclusion of query parameters, as described in the tag description. You must specify exactly one of the action attribute, the forward attribute, the href attribute, the linkName attribute, or the page attribute.

(RT EXPR)
anchor

Optional anchor tag ("#xxx") to be added to the generated hyperlink. Specify this value without any "#" character.

(RT EXPR)
forward

Logical name of a global ActionForward that contains the actual content-relative URI of the destination of this transfer. This hyperlink may be dynamically modified by the inclusion of query parameters, as described in the tag description. You must specify exactly one of the action attribute, the forward attribute, the href attribute, the linkName attribute, or the page attribute.

(RT EXPR)
href

The URL to which this hyperlink will transfer control if activated. This hyperlink may be dynamically modified by the inclusion of query parameters, as described in the tag description. You must specify exactly one of the action attribute, the forward attribute, the href attribute, the linkName attribute, or the page attribute.

(RT EXPR)
indexed | Valid only inside of logic:iterate tag. If true then indexed parameter with name from indexId attribute will be added to the query string. Indexed parameter looks like "index[32]". Number in brackets will be generated for every iteration and taken from ancestor logic:iterate tag. (RT EXPR)
indexId | By this attribute different name for the indexed parameter can be specified. Take a look to the "indexed" attribute for details. (RT EXPR)
linkName

The anchor name to be defined within this page, so that you can reference it with intra-page hyperlinks. In other words, the value specified here will render a "name" element in the generated anchor tag.

(RT EXPR)
name

The name of a JSP bean that contains a Map representing the query parameters (if property is not specified), or a JSP bean whose property getter is called to return a Map (if property is specified).

(RT EXPR)
onblur

JavaScript event handler that is executed when this element loses input focus.

(RT EXPR)
onclick

JavaScript event handler that is executed when this element receives a mouse click.

(RT EXPR)
ondblclick

JavaScript event handler that is executed when this element receives a mouse double click.

(RT EXPR)
onfocus

JavaScript event handler that is executed when this element receives input focus.

(RT EXPR)
onkeydown

JavaScript event handler that is executed when this element receives a key down event.

(RT EXPR)
onkeypress

JavaScript event handler that is executed when this element receives a key press event.

(RT EXPR)
onkeyup

JavaScript event handler that is executed when this element receives a key up event.

(RT EXPR)
onmousedown

JavaScript event handler that is executed when this element receives a mouse down event.

(RT EXPR)
onmousemove

JavaScript event handler that is executed when this element receives a mouse move event.

(RT EXPR)
onmouseout

JavaScript event handler that is executed when this element receives a mouse out event.

(RT EXPR)
onmouseover

JavaScript event handler that is executed when this element receives a mouse over event.

(RT EXPR)
onmouseup

JavaScript event handler that is executed when this element receives a mouse up event.

(RT EXPR)
page

The module-relative path (beginning with a "/" character) to which this hyperlink will transfer control if activated. This hyperlink may be dynamically modified by the inclusion of query parameters, as described in the tag description. You must specify exactly one of the action attribute, forward attribute, the href attribute, the linkName attribute, or the page attribute.

(RT EXPR)
paramId

The name of the request parameter that will be dynamically added to the generated hyperlink. The corresponding value is defined by the paramName and (optional) paramProperty attributes, optionally scoped by the paramScope attribute

(RT EXPR)
paramName

The name of a JSP bean that is a String containing the value for the request parameter named by paramId (if paramProperty is not specified), or a JSP bean whose property getter is called to return a String (if paramProperty is specified). The JSP bean is constrained to the bean scope specified by the paramScope property, if it is specified.

(RT EXPR)
paramProperty

The name of a property of the bean specified by the paramName attribute, whose return value must be a String containing the value of the request parameter (named by the paramId attribute) that will be dynamically added to this hyperlink.

(RT EXPR)
paramScope

The scope within which to search for the bean specified by the paramName attribute. If not specified, all scopes are searched.

(RT EXPR)
property

The name of a property of the bean specified by the name attribute, whose return value must be a java.util.Map containing the query parameters to be added to the hyperlink. You must specify the name attribute if you specify this attribute.

(RT EXPR)
scope

The scope within which to search for the bean specified by the name attribute. If not specified, all scopes are searched.

(RT EXPR)
style

CSS styles to be applied to this element.

(RT EXPR)
styleClass | CSS stylesheet class to be applied to this HTML element (renders a "class" attribute). (RT EXPR)
styleId | Identifier to be assigned to this HTML element (renders an "id" attribute). (RT EXPR)
tabindex

The tab order (ascending positive integers) for this element.

(RT EXPR)
target

The window target in which the resource requested by this hyperlink will be displayed, for example in a framed presentation.

(RT EXPR)
title

The advisory title for this hyperlink.

(RT EXPR)
titleKey

The message resources key for the advisory title for this element.

(RT EXPR)
transaction

If set to true, any current transaction control token will be included in the generated hyperlink, so that it will pass an isTokenValid() test in the receiving Action.

(RT EXPR)

Back to top

messages - Conditionally display a set of accumulated messages.

Displays a set of messages prepared by a business logic component and stored as an ActionMessages object, ActionErrors object, a String, or a String array in any scope. If such a bean is not found, nothing will be rendered.

In order to use this tag successfully, you must have defined an application scope MessageResources bean under the default attribute name.

Attribute Name | Description
bundle | The servlet context attribute key for the MessageResources instance to use. If not specified, defaults to the application resources configured for our action servlet. (RT EXPR)
footer | This value is an optional message resource key that will be printed after the iteration of messages has finished. (RT EXPR)
header | This value is an optional message resource key that will be printed before the iteration of messages begins. (RT EXPR)
id | The name of a page scope JSP bean that will contain the current element of the collection of messages on each iteration, if it is not null. (REQUIRED)
locale | The session attribute key for the Locale used to select messages to be displayed. If not specified, defaults to the Struts standard value. (RT EXPR)
message | By default the tag will retrieve the bean it will iterate over from the Action.ERROR_KEY constant string, but if this attribute is set to 'true' the bean will be retrieved from the Action.MESSAGE_KEY constant string. Also if this is set to 'true', any value assigned to the name attribute will be ignored. (RT EXPR)
name | Name of the bean in any scope under which our messages have been stored. If not present, the name specified by the Action.ERROR_KEY constant string will be used. (RT EXPR)
property | Name of the property for which messages should be displayed. If not specified, all messages (regardless of property) are displayed. (RT EXPR)

Back to top

multibox - Render A Checkbox Input Field

Renders an HTML <input> element of type checkbox, whose "checked" status is initialized based on whether the specified value matches one of the elements of the underlying property's array of current values. This element is useful when you have large numbers of checkboxes, and prefer to combine the values into a single array-valued property instead of multiple boolean properties. This tag is only valid when nested inside a form tag body.

WARNING: In order to correctly recognize cases where none of the associated checkboxes are selected, the ActionForm bean associated with this form must include a statement setting the corresponding array to zero length in the reset() method.

The value to be returned to the server, if this checkbox is selected, must be defined by one of the following methods:

  • Specify a value attribute, whose contents will be used literally as the value to be returned.
  • Specify no value attribute, and the nested body content of this tag will be used as the value to be returned.
Attribute Name | Description
accesskey | The keyboard character used to move focus immediately to this element. (RT EXPR)
alt

The alternate text for this element.

(RT EXPR)
altKey

The message resources key of the alternate text for this element.

(RT EXPR)
disabled | Set to true if this input field should be disabled. (RT EXPR)
name | The attribute name of the bean whose properties are consulted when rendering the current value of this input field. If not specified, the bean associated with the form tag we are nested within is utilized. (RT EXPR)
onblur | JavaScript event handler executed when this element loses input focus. (RT EXPR)
onchange | JavaScript event handler executed when this element loses input focus and its value has changed. (RT EXPR)
onclick | JavaScript event handler executed when this element receives a mouse click. (RT EXPR)
ondblclick | JavaScript event handler executed when this element receives a mouse double click. (RT EXPR)
onfocus | JavaScript event handler executed when this element receives input focus. (RT EXPR)
onkeydown | JavaScript event handler executed when this element has focus and a key is depressed. (RT EXPR)
onkeypress | JavaScript event handler executed when this element has focus and a key is depressed and released. (RT EXPR)
onkeyup | JavaScript event handler executed when this element has focus and a key is released. (RT EXPR)
onmousedown | JavaScript event handler executed when this element is under the mouse pointer and a mouse button is depressed. (RT EXPR)
onmousemove | JavaScript event handler executed when this element is under the mouse pointer and the pointer is moved. (RT EXPR)
onmouseout | JavaScript event handler executed when this element was under the mouse pointer but the pointer was moved outside the element. (RT EXPR)
onmouseover | JavaScript event handler executed when this element was not under the mouse pointer but the pointer is moved inside the element. (RT EXPR)
onmouseup | JavaScript event handler executed when this element is under the mouse pointer and a mouse button is released. (RT EXPR)
property | Name of the request parameter that will be included with this submission, set to the specified value. (REQUIRED) (RT EXPR)
style | CSS styles to be applied to this HTML element. (RT EXPR)
styleClass | CSS stylesheet class to be applied to this HTML element (renders a "class" attribute). (RT EXPR)
styleId | Identifier to be assigned to this HTML element (renders an "id" attribute). (RT EXPR)
tabindex | The tab order (ascending positive integers) for this element. (RT EXPR)
title

The advisory title for this element.

(RT EXPR)
titleKey

The message resources key for the advisory title for this element.

(RT EXPR)
value | The value to be transmitted if this checkbox is checked when the form is submitted. (RT EXPR)

Back to top

option - Render A Select Option

Render an HTML <option> element, representing one of the choices for an enclosing <select> element. The text displayed to the user comes from either the body of this tag, or from a message string looked up based on the bundle, locale, and key attributes.

If the value of the corresponding bean property matches the specified value, this option will be marked selected. This tag is only valid when nested inside a <html:select> tag body.

Attribute Name | Description
bundle | The servlet context attributes key for the MessageResources instance to use. If not specified, defaults to the application resources configured for our action servlet. (RT EXPR)
disabled | Set to true if this option should be disabled. (RT EXPR)
key | If specified, defines the message key to be looked up in the resource bundle specified by bundle for the text displayed to the user for this option. If not specified, the text to be displayed is taken from the body content of this tag. (RT EXPR)
locale | The session attributes key for the Locale instance to use for looking up the message specified by the key attribute. If not specified, uses the standard Struts session attribute name. (RT EXPR)
style | CSS styles to be applied to this HTML element. (RT EXPR)
styleClass | CSS stylesheet class to be applied to this HTML element (renders a "class" attribute). (RT EXPR)
styleId | Identifier to be assigned to this HTML element (renders an "id" attribute). (RT EXPR)
value | Value to be submitted for this field if this option is selected by the user. (REQUIRED) (RT EXPR)

Back to top

options - Render a Collection of Select Options

Renders a set of HTML <option> elements, representing possible choices for a <select> element. This tag can be used multiple times within a single <html:select> element, either in conjunction with or instead of one or more <html:option> or <html:optionsCollection> elements.

This tag operates in one of two major modes, depending on whether or not the collection attribute is specified. If the collection attribute is included, the following rules apply:

  • The collection attribute is interpreted as the name of a JSP bean, in some scope, that itself represents a collection of individual beans, one per option value to be rendered.
  • The property attribute is interpreted as the name of a property of the individual beans included in the collection, and is used to retrieve the value that will be returned to the server if this option is selected.
  • The labelProperty attribute is interpreted as the name of a property of the individual beans included in the collection, and is used to retrieve the label that will be displayed to the user for this option. If the labelProperty attribute is not specified, the property named by the property attribute will be used to select both the value returned to the server and the label displayed to the user for this option.

If the collection attribute is not specified, the rules described in the remainder of this section apply.

The collection of values actually selected depends on the presence or absence of the name and property attributes. The following combinations are allowed:

  • Only name is specified - The value of this attribute is the name of a JSP bean in some scope that is the collection.
  • Only property is specified - The value of this attribute is the name of a property of the ActionForm bean associated with our form, which will return the collection.
  • Both name and property are specified - The value of the name attribute identifies a JSP bean in some scope. The value of the property attribute is the name of some property of that bean which will return the collection.

The collection of labels displayed to the user can be the same as the option values themselves, or can be different, depending on the presence or absence of the labelName and labelProperty attributes. If this feature is used, the collection of labels must contain the same number of elements as the corresponding collection of values. The following combinations are allowed:

  • Neither labelName nor labelProperty is specified - The labels will be the same as the option values themselves.
  • Only labelName is specified - The value of this attribute is the name of a JSP bean in some scope that is the collection.
  • Only labelProperty is specified - The value of this attribute is the name of a property of the ActionForm bean associated with our form, which will return the collection.
  • Both labelName and labelProperty are specified - The value of the labelName attribute identifies a JSP bean in some scope. The value of the labelProperty attribute is the name of some property of that bean which will return the collection.

Note that this tag does not support a styleId attribute, as it would have to apply the value to all the option elements created by this element, which would mean that more than one id element might have the same value, which the HTML specification says is illegal.

Attribute Name | Description
collection | Name of the JSP bean (in some scope) which is itself a Collection of other beans, each of which has properties named by the "property" and "labelProperty" attributes that are used to retrieve the value and label for each option, respectively. (RT EXPR)
filter | Set to false if you do NOT want the option labels filtered for sensitive characters in HTML. By default, such values are filtered. (RT EXPR)
labelName | Name of the JSP bean (in some scope) containing the collection of labels to be displayed to the user for these options. (RT EXPR)
labelProperty | Property of the form bean, or the bean specified by the labelName attribute, that will return the collection of labels to be displayed to the user for these options. (RT EXPR)
name | Name of the JSP bean (in some scope) containing the collection of values to be returned to the server for these options. If not specified, the form bean associated with our form is assumed. (RT EXPR)
property | Property of the form bean, or the bean specified by the name attribute, that will return the collection of values to returned to the server for these options. (RT EXPR)
style | CSS styles to be applied to this HTML element. (RT EXPR)
styleClass | CSS stylesheet class to be applied to this HTML element (renders a "class" attribute). (RT EXPR)

Back to top

optionsCollection - Render a Collection of Select Options

Renders a set of HTML <option> elements, representing possible choices for a <select> element. This tag can be used multiple times within a single <html:select> element, either in conjunction with or instead of one or more <html:option> or <html:options> elements.

This tag operates on a collection of beans, where each bean has a label property and a value property. The actual names of these properties can be configured using the label and value attributes of this tag.

This tag differs from the <html:options> tag in that it makes more consistent use of the name and property attributes, and allows the collection to be more easily obtained from the enclosing form bean.

Note that this tag does not support a styleId attribute, as it would have to apply the value to all the option elements created by this element, which would mean that more than one id element might have the same value, which the HTML specification says is illegal.

Attribute Name | Description
filter | Set to false if you do NOT want the option labels filtered for sensitive characters in HTML. By default, such values are filtered. (RT EXPR)
label | The property of the bean within the collection which represents the label to be rendered for each option. Defaults to "label". (RT EXPR)
name | The attribute name of the bean whose properties are consulted when rendering the current value of this input field. If not specified, the bean associated with the form tag we are nested within is utilized. (RT EXPR)
property | The property of the form bean, or the bean specified by the name attribute, that will return the collection of objects to be rendered for these options. (RT EXPR)
style | CSS styles to be applied to this HTML element. (RT EXPR)
styleClass | CSS stylesheet class to be applied to this HTML element (renders a "class" attribute). (RT EXPR)
value | The property of the bean within the collection which represents the value to be rendered for each option. Defaults to "value". (RT EXPR)

Back to top

password - Render A Password Input Field
Renders an HTML <input> element of type password, populated from the specified value or the specified property of the bean associated with our current form. This tag is only valid when nested inside a form tag body.
Attribute Name | Description
accesskey | The keyboard character used to move focus immediately to this element. (RT EXPR)
alt

The alternate text for this element.

(RT EXPR)
altKey

The message resources key of the alternate text for this element.

(RT EXPR)
disabled | Set to true if this input field should be disabled. (RT EXPR)
indexed | Valid only inside of logic:iterate tag. If true then name of the html tag will be rendered as "id[34].propertyName". Number in brackets will be generated for every iteration and taken from ancestor logic:iterate tag. (RT EXPR)
maxlength | Maximum number of input characters to accept. [No limit] (RT EXPR)
name | The attribute name of the bean whose properties are consulted when rendering the current value of this input field. If not specified, the bean associated with the form tag we are nested within is utilized. (RT EXPR)
onblur | JavaScript event handler executed when this element loses input focus. (RT EXPR)
onchange | JavaScript event handler executed when this element loses input focus and its value has changed. (RT EXPR)
onclick | JavaScript event handler executed when this element receives a mouse click. (RT EXPR)
ondblclick | JavaScript event handler executed when this element receives a mouse double click. (RT EXPR)
onfocus | JavaScript event handler executed when this element receives input focus. (RT EXPR)
onkeydown | JavaScript event handler executed when this element has focus and a key is depressed. (RT EXPR)
onkeypress | JavaScript event handler executed when this element has focus and a key is depressed and released. (RT EXPR)
onkeyup | JavaScript event handler executed when this element has focus and a key is released. (RT EXPR)
onmousedown | JavaScript event handler executed when this element is under the mouse pointer and a mouse button is depressed. (RT EXPR)
onmousemove | JavaScript event handler executed when this element is under the mouse pointer and the pointer is moved. (RT EXPR)
onmouseout | JavaScript event handler executed when this element was under the mouse pointer but the pointer was moved outside the element. (RT EXPR)
onmouseover | JavaScript event handler executed when this element was not under the mouse pointer but the pointer is moved inside the element. (RT EXPR)
onmouseup | JavaScript event handler executed when this element is under the mouse pointer and a mouse button is released. (RT EXPR)
property | Name of the request parameter that will be included with this submission, set to the specified value. (REQUIRED) (RT EXPR)
readonly | Set to true if this input field should be read only. (RT EXPR)
redisplay | Boolean flag indicating whether or not existing values will be redisplayed if they exist. Even though the redisplayed value will be shown as asterisks on the visible HTML page, the cleartext of the actual password value will be visible though the "Show Page Source" menu option of the client browser. You may wish to set this value to false on login pages. Defaults to true for consistency with all other form tags that redisplay their contents. (RT EXPR)
size | Number of character positions to allocate. [Browser default] (RT EXPR)
style | CSS styles to be applied to this HTML element. (RT EXPR)
styleClass | CSS stylesheet class to be applied to this HTML element (renders a "class" attribute). (RT EXPR)
styleId | Identifier to be assigned to this HTML element (renders an "id" attribute). (RT EXPR)
tabindex | The tab order (ascending positive integers) for this element. (RT EXPR)
title

The advisory title for this element.

(RT EXPR)
titleKey

The message resources key for the advisory title for this element.

(RT EXPR)
value | Value of the label to be placed on this button. This value will also be submitted as the value of the specified request parameter. [Body of this tag (if any)] (RT EXPR)

Back to top

radio - Render A Radio Button Input Field

Renders an HTML <input> element of type radio, populated from the specified property of the bean associated with our current form. This tag is only valid when nested inside a form tag body.

If an iterator is used to render a series of radio tags, the idName attribute may be used to specify the name of the bean exposed by the iterator. In this case, the value attribute is used as the name of a property on the idName bean that returns the value of the radio tag in this iteration.

Attribute Name | Description
accesskey | The keyboard character used to move focus immediately to this element. (RT EXPR)
alt

The alternate text for this element.

(RT EXPR)
altKey

The message resources key of the alternate text for this element.

(RT EXPR)
disabled | Set to true if this input field should be disabled. (RT EXPR)
idName

Since: Struts 1.1

Name of the bean (in some scope) that will return the value of the radio tag. Usually exposed by an iterator. When the idName attribute is present, the value attribute is used as the name of the property on the idName bean that will return the value of the radio tag for this iteration.

(RT EXPR)
indexed | Valid only inside of logic:iterate tag. If true then name of the html tag will be rendered as "id[34].propertyName". Number in brackets will be generated for every iteration and taken from ancestor logic:iterate tag. (RT EXPR)
name | The attribute name of the bean whose properties are consulted when rendering the current value of this input field. If not specified, the bean associated with the form tag we are nested within is utilized. (RT EXPR)
onblur | JavaScript event handler executed when this element loses input focus. (RT EXPR)
onchange | JavaScript event handler executed when this element loses input focus and its value has changed. (RT EXPR)
onclick | JavaScript event handler executed when this element receives a mouse click. (RT EXPR)
ondblclick | JavaScript event handler executed when this element receives a mouse double click. (RT EXPR)
onfocus | JavaScript event handler executed when this element receives input focus. (RT EXPR)
onkeydown | JavaScript event handler executed when this element has focus and a key is depressed. (RT EXPR)
onkeypress | JavaScript event handler executed when this element has focus and a key is depressed and released. (RT EXPR)
onkeyup | JavaScript event handler executed when this element has focus and a key is released. (RT EXPR)
onmousedown | JavaScript event handler executed when this element is under the mouse pointer and a mouse button is depressed. (RT EXPR)
onmousemove | JavaScript event handler executed when this element is under the mouse pointer and the pointer is moved. (RT EXPR)
onmouseout | JavaScript event handler executed when this element was under the mouse pointer but the pointer was moved outside the element. (RT EXPR)
onmouseover | JavaScript event handler executed when this element was not under the mouse pointer but the pointer is moved inside the element. (RT EXPR)
onmouseup | JavaScript event handler executed when this element is under the mouse pointer and a mouse button is released. (RT EXPR)
property | The corresponding bean property for this radio tag. (REQUIRED) (RT EXPR)
style | CSS styles to be applied to this HTML element. (RT EXPR)
styleClass | CSS stylesheet class to be applied to this HTML element (renders a "class" attribute). (RT EXPR)
styleId | Identifier to be assigned to this HTML element (renders an "id" attribute). (RT EXPR)
tabindex | The tab order (ascending positive integers) for this element. (RT EXPR)
title

The advisory title for this element.

(RT EXPR)
titleKey

The message resources key for the advisory title for this element.

(RT EXPR)
value | The value of the radio tag. (REQUIRED) (RT EXPR)

Back to top

reset - Render A Reset Button Input Field
Renders an HTML <input> element of type reset.
Attribute Name | Description
accesskey | The keyboard character used to move focus immediately to this element. (RT EXPR)
alt

The alternate text for this element.

(RT EXPR)
altKey

The message resources key of the alternate text for this element.

(RT EXPR)
disabled | Set to true if this input field should be disabled. (RT EXPR)
onblur | JavaScript event handler executed when this element loses input focus. (RT EXPR)
onchange | JavaScript event handler executed when this element loses input focus and its value has changed. (RT EXPR)
onclick | JavaScript event handler executed when this element receives a mouse click. (RT EXPR)
ondblclick | JavaScript event handler executed when this element receives a mouse double click. (RT EXPR)
onfocus | JavaScript event handler executed when this element receives input focus. (RT EXPR)
onkeydown | JavaScript event handler executed when this element has focus and a key is depressed. (RT EXPR)
onkeypress | JavaScript event handler executed when this element has focus and a key is depressed and released. (RT EXPR)
onkeyup | JavaScript event handler executed when this element has focus and a key is released. (RT EXPR)
onmousedown | JavaScript event handler executed when this element is under the mouse pointer and a mouse button is depressed. (RT EXPR)
onmousemove | JavaScript event handler executed when this element is under the mouse pointer and the pointer is moved. (RT EXPR)
onmouseout | JavaScript event handler executed when this element was under the mouse pointer but the pointer was moved outside the element. (RT EXPR)
onmouseover | JavaScript event handler executed when this element was not under the mouse pointer but the pointer is moved inside the element. (RT EXPR)
onmouseup | JavaScript event handler executed when this element is under the mouse pointer and a mouse button is released. (RT EXPR)
property | Name of the input field that will be generated. (RT EXPR)
style | CSS styles to be applied to this HTML element. (RT EXPR)
styleClass | CSS stylesheet class to be applied to this HTML element (renders a "class" attribute). (RT EXPR)
styleId | Identifier to be assigned to this HTML element (renders an "id" attribute). (RT EXPR)
tabindex | The tab order (ascending positive integers) for this element. (RT EXPR)
title

The advisory title for this element.

(RT EXPR)
titleKey

The message resources key for the advisory title for this element.

(RT EXPR)
value | Value of the label to be placed on this button. [Body of this tag (if any), or "Reset"] (RT EXPR)

Back to top

rewrite - Render an URI

Renders a request URI based on exactly the same rules as the link tag does, but without creating the <a> hyperlink. This value is useful when you want to generate a string constant for use by a JavaScript procedure.

Attribute Name Description
action

Logical name of a Action that contains the actual content-relative URI of the destination of this transfer. This hyperlink may be dynamically modified by the inclusion of query parameters, as described in the tag description. You must specify exactly one of the action attribute, the forward attribute, the href attribute, or the page attribute.

(RT EXPR)
anchor

Optional anchor tag ("#xxx") to be added to the generated hyperlink. Specify this value without any "#" character.

(RT EXPR)
forward

Logical name of a global ActionForward that contains the actual content-relative URI of the destination of this transfer. This hyperlink may be dynamically modified by the inclusion of query parameters, as described in the tag description. You must specify exactly one of the action attribute, the forward attribute, the href attribute, or the page attribute.

(RT EXPR)
href

The URL to which this hyperlink will transfer control if activated. This hyperlink may be dynamically modified by the inclusion of query parameters, as described in the tag description. You must specify exactly one of the action attribute, the forward attribute, the href attribute, or the page attribute.

(RT EXPR)
name

The name of a JSP bean that contains a Map representing the query parameters (if property is not specified), or a JSP bean whose property getter is called to return a Map (if property is specified).

(RT EXPR)
page

The module-relative path (beginning with a "/" character) to which this hyperlink will transfer control if activated. This hyperlink may be dynamically modified by the inclusion of query parameters, as described in the tag description. You must specify exactly one of the action attribute, the forward attribute, the href attribute, or the page attribute.

(RT EXPR)
paramId

The name of the request parameter that will be dynamically added to the generated hyperlink. The corresponding value is defined by the paramName and (optional) paramProperty attributes, optionally scoped by the paramScope attribute

(RT EXPR)
paramName

The name of a JSP bean that is a String containing the value for the request parameter named by paramId (if paramProperty is not specified), or a JSP bean whose property getter is called to return a String (if paramProperty is specified). The JSP bean is constrained to the bean scope specified by the paramScope property, if it is specified.

(RT EXPR)
paramProperty

The name of a property of the bean specified by the paramName attribute, whose return value must be a String containing the value of the request parameter (named by the paramId attribute) that will be dynamically added to this hyperlink.

(RT EXPR)
paramScope

The scope within which to search for the bean specified by the paramName attribute. If not specified, all scopes are searched.

(RT EXPR)
property

The name of a property of the bean specified by the name attribute, whose return value must be a java.util.Map containing the query parameters to be added to the hyperlink. You must specify the name attribute if you specify this attribute.

(RT EXPR)
scope

The scope within which to search for the bean specified by the name attribute. If not specified, all scopes are searched.

(RT EXPR)
transaction

If set to true, any current transaction control token will be included in the generated hyperlink, so that it will pass an isTokenValid() test in the receiving Action.

(RT EXPR)

Back to top

select - Render A Select Element

Renders an HTML <select> element, associated with a bean property specified by our attributes. This tag is only valid when nested inside a form tag body.

This tag operates in two modes, depending upon the state of the multiple attribute, which affects the data type of the associated property you should use:

  • multiple="true" IS NOT selected - The corresponding property should be a scalar value of any supported data type.
  • multiple="true" IS selected - The corresponding property should be an array of any supported data type.

WARNING: In order to correctly recognize cases where no selection at all is made, the ActionForm bean associated with this form must include a statement resetting the scalar property to a default value (if multiple is not set), or the array property to zero length (if multiple is set) in the reset() method.

Attribute Name | Description
alt

The alternate text for this element.

(RT EXPR)
altKey

The message resources key of the alternate text for this element.

(RT EXPR)
disabled | Set to true if this input field should be disabled. (RT EXPR)
indexed | Valid only inside of logic:iterate tag. If true then name of the html tag will be rendered as "id[34].propertyName". Number in brackets will be generated for every iteration and taken from ancestor logic:iterate tag. (RT EXPR)
multiple | If set to any arbitrary value, the rendered select element will support multiple selections. (RT EXPR)
name | The attribute name of the bean whose properties are consulted to determine which option should be pre-selected when rendering this input field. If not specified, the bean associated with the enclosing <html:form> tag is utilized. (RT EXPR)
onblur | JavaScript event handler executed when this element loses input focus. (RT EXPR)
onchange | JavaScript event handler executed when this element loses input focus and its value has changed. (RT EXPR)
onclick | JavaScript event handler executed when this element receives a mouse click. (RT EXPR)
ondblclick | JavaScript event handler executed when this element receives a mouse double click. (RT EXPR)
onfocus | JavaScript event handler executed when this element receives input focus. (RT EXPR)
onkeydown | JavaScript event handler executed when this element has focus and a key is depressed. (RT EXPR)
onkeypress | JavaScript event handler executed when this element has focus and a key is depressed and released. (RT EXPR)
onkeyup | JavaScript event handler executed when this element has focus and a key is released. (RT EXPR)
onmousedown | JavaScript event handler executed when this element is under the mouse pointer and a mouse button is depressed. (RT EXPR)
onmousemove | JavaScript event handler executed when this element is under the mouse pointer and the pointer is moved. (RT EXPR)
onmouseout | JavaScript event handler executed when this element was under the mouse pointer but the pointer was moved outside the element. (RT EXPR)
onmouseover | JavaScript event handler executed when this element was not under the mouse pointer but the pointer is moved inside the element. (RT EXPR)
onmouseup | JavaScript event handler executed when this element is under the mouse pointer and a mouse button is released. (RT EXPR)
property | Name of the request parameter that will be included with this submission, set to the specified value. (REQUIRED) (RT EXPR)
size | The number of available options displayed at one time. (RT EXPR)
style | CSS styles to be applied to this HTML element. (RT EXPR)
styleClass | CSS stylesheet class to be applied to this HTML element (renders a "class" attribute). (RT EXPR)
styleId | Identifier to be assigned to this HTML element (renders an "id" attribute). (RT EXPR)
tabindex | The tab order (ascending positive integers) for this element. (RT EXPR)
title

The advisory title for this element.

(RT EXPR)
titleKey

The message resources key for the advisory title for this element.

(RT EXPR)
value | The value to compare with for marking an option selected. (RT EXPR)

Back to top

submit - Render A Submit Button
Renders an HTML <input> element of type submit.

If a graphical button is needed (a button with an image), then the image tag is more appropriate.

Attribute Name | Description
accesskey | The keyboard character used to move focus immediately to this element. (RT EXPR)
alt

The alternate text for this element.

(RT EXPR)
altKey

The message resources key of the alternate text for this element.

(RT EXPR)
disabled | Set to true if this input field should be disabled. (RT EXPR)
indexed | Valid only inside of logic:iterate tag. If true then name of the html tag will be rendered as "propertyName[34]". Number in brackets will be generated for every iteration and taken from ancestor logic:iterate tag. (RT EXPR)
onblur | JavaScript event handler executed when this element loses input focus. (RT EXPR)
onchange | JavaScript event handler executed when this element loses input focus and its value has changed. (RT EXPR)
onclick | JavaScript event handler executed when this element receives a mouse click. (RT EXPR)
ondblclick | JavaScript event handler executed when this element receives a mouse double click. (RT EXPR)
onfocus | JavaScript event handler executed when this element receives input focus. (RT EXPR)
onkeydown | JavaScript event handler executed when this element has focus and a key is depressed. (RT EXPR)
onkeypress | JavaScript event handler executed when this element has focus and a key is depressed and released. (RT EXPR)
onkeyup | JavaScript event handler executed when this element has focus and a key is released. (RT EXPR)
onmousedown | JavaScript event handler executed when this element is under the mouse pointer and a mouse button is depressed. (RT EXPR)
onmousemove | JavaScript event handler executed when this element is under the mouse pointer and the pointer is moved. (RT EXPR)
onmouseout | JavaScript event handler executed when this element was under the mouse pointer but the pointer was moved outside the element. (RT EXPR)
onmouseover | JavaScript event handler executed when this element was not under the mouse pointer but the pointer is moved inside the element. (RT EXPR)
onmouseup | JavaScript event handler executed when this element is under the mouse pointer and a mouse button is released. (RT EXPR)
property | Name of the request parameter that will be included with this submission, set to the specified value. (RT EXPR)
style | CSS styles to be applied to this HTML element. (RT EXPR)
styleClass | CSS stylesheet class to be applied to this HTML element (renders a "class" attribute). (RT EXPR)
styleId | Identifier to be assigned to this HTML element (renders an "id" attribute). (RT EXPR)
tabindex | The tab order (ascending positive integers) for this element. (RT EXPR)
title

The advisory title for this element.

(RT EXPR)
titleKey

The message resources key for the advisory title for this element.

(RT EXPR)
value | The value of the button label. (RT EXPR)

Back to top

text - Render An Input Field of Type text
Render an input button of type text. This tag is only valid when nested inside a form tag body.
Attribute Name | Description
accesskey | The keyboard character used to move focus immediately to this element. (RT EXPR)
alt

The alternate text for this element.

(RT EXPR)
altKey

The message resources key of the alternate text for this element.

(RT EXPR)
disabled | Set to true if this input field should be disabled. (RT EXPR)
indexed | Valid only inside of logic:iterate tag. If true then name of the html tag will be rendered as "id[34].propertyName". Number in brackets will be generated for every iteration and taken from ancestor logic:iterate tag. (RT EXPR)
maxlength | Maximum number of input characters to accept. [No limit] (RT EXPR)
name | The attribute name of the bean whose properties are consulted when rendering the current value of this input field. If not specified, the bean associated with the form tag we are nested within is utilized. (RT EXPR)
onblur | JavaScript event handler executed when this element loses input focus. (RT EXPR)
onchange | JavaScript event handler executed when this element loses input focus and its value has changed. (RT EXPR)
onclick | JavaScript event handler executed when this element receives a mouse click. (RT EXPR)
ondblclick | JavaScript event handler executed when this element receives a mouse double click. (RT EXPR)
onfocus | JavaScript event handler executed when this element receives input focus. (RT EXPR)
onkeydown | JavaScript event handler executed when this element has focus and a key is depressed. (RT EXPR)
onkeypress | JavaScript event handler executed when this element has focus and a key is depressed and released. (RT EXPR)
onkeyup | JavaScript event handler executed when this element has focus and a key is released. (RT EXPR)
onmousedown | JavaScript event handler executed when this element is under the mouse pointer and a mouse button is depressed. (RT EXPR)
onmousemove | JavaScript event handler executed when this element is under the mouse pointer and the pointer is moved. (RT EXPR)
onmouseout | JavaScript event handler executed when this element was under the mouse pointer but the pointer was moved outside the element. (RT EXPR)
onmouseover | JavaScript event handler executed when this element was not under the mouse pointer but the pointer is moved inside the element. (RT EXPR)
onmouseup | JavaScript event handler executed when this element is under the mouse pointer and a mouse button is released. (RT EXPR)
property | Name of this input field, and the name of the corresponding bean property if value is not specified. The corresponding bean property (if any) must be of type String. (REQUIRED) (RT EXPR)
readonly | Set to true if this input field should be read only. (RT EXPR)
size | Number of character positions to allocate. [Browser default] (RT EXPR)
style | CSS styles to be applied to this HTML element. (RT EXPR)
styleClass | CSS stylesheet class to be applied to this HTML element (renders a "class" attribute). (RT EXPR)
styleId | Identifier to be assigned to this HTML element (renders an "id" attribute). (RT EXPR)
tabindex | The tab order (ascending positive integers) for this element. (RT EXPR)
title

The advisory title for this element.

(RT EXPR)
titleKey

The message resources key for the advisory title for this element.

(RT EXPR)
value | Value to which this field should be initialized. [Use the corresponding bean property value] (RT EXPR)

Back to top

textarea - Render A Textarea
Render a textarea element. This tag is only valid when nested inside a form tag body.
Attribute Name | Description
accesskey | The keyboard character used to move focus immediately to this element. (RT EXPR)
alt

The alternate text for this element.

(RT EXPR)
altKey

The message resources key of the alternate text for this element.

(RT EXPR)
cols | The number of columns to display. (RT EXPR)
disabled | Set to true if this input field should be disabled. (RT EXPR)
indexed | Valid only inside of logic:iterate tag. If true then name of the html tag will be rendered as "id[34].propertyName". Number in brackets will be generated for every iteration and taken from ancestor logic:iterate tag. (RT EXPR)
name | The attribute name of the bean whose properties are consulted when rendering the current value of this input field. If not specified, the bean associated with the form tag we are nested within is utilized. (RT EXPR)
onblur | JavaScript event handler executed when this element loses input focus. (RT EXPR)
onchange | JavaScript event handler executed when this element loses input focus and its value has changed. (RT EXPR)
onclick | JavaScript event handler executed when this element receives a mouse click. (RT EXPR)
ondblclick | JavaScript event handler executed when this element receives a mouse double click. (RT EXPR)
onfocus | JavaScript event handler executed when this element receives input focus. (RT EXPR)
onkeydown | JavaScript event handler executed when this element has focus and a key is depressed. (RT EXPR)
onkeypress | JavaScript event handler executed when this element has focus and a key is depressed and released. (RT EXPR)
onkeyup | JavaScript event handler executed when this element has focus and a key is released. (RT EXPR)
onmousedown | JavaScript event handler executed when this element is under the mouse pointer and a mouse button is depressed. (RT EXPR)
onmousemove | JavaScript event handler executed when this element is under the mouse pointer and the pointer is moved. (RT EXPR)
onmouseout | JavaScript event handler executed when this element was under the mouse pointer but the pointer was moved outside the element. (RT EXPR)
onmouseover | JavaScript event handler executed when this element was not under the mouse pointer but the pointer is moved inside the element. (RT EXPR)
onmouseup | JavaScript event handler executed when this element is under the mouse pointer and a mouse button is released. (RT EXPR)
property | Name of this input field, and the name of the corresponding bean property if value is not specified. The corresponding bean property (if any) must be of type String. (REQUIRED) (RT EXPR)
readonly | Set to true if this input field should be read only. (RT EXPR)
rows | The number of rows to display. (RT EXPR)
style | CSS styles to be applied to this HTML element. (RT EXPR)
styleClass | CSS stylesheet class to be applied to this HTML element (renders a "class" attribute). (RT EXPR)
styleId | Identifier to be assigned to this HTML element (renders an "id" attribute). (RT EXPR)
tabindex | The tab order (ascending positive integers) for this element. (RT EXPR)
title

The advisory title for this element.

(RT EXPR)
titleKey

The message resources key for the advisory title for this element.

(RT EXPR)
value | Value to which this field should be initialized. [Use the corresponding bean property value] (RT EXPR)

Back to top

xhtml - Render HTML tags as XHTML

Using this tag in a page tells all other html taglib tags to render themselves as XHTML. This is useful when composing pages with JSP includes or Tiles. This tag has the same effect as using <html:html xhtml="true">.

Attribute Name Description

Back to top

Copyright (c) 2000-2003, Apache Software Foundation - Comments?
Powered by Struts