Properties for Struts nested tags
This documentation describes the properties for the elements that are defined in the Struts nested tag library. By default, the name of each of these elements has an nested: prefix.
Each Struts element has a number of properties that you can set by using the element's Properties view. Use this table of properties while working with the element's Properties view, to look up properties for which you want additional detail. Some properties have the same name but different usage in different elements. The properties are listed in alphabetical order.
Properties In element Description accept file Specifies a comma-delimited list of content types that the server to which you submit knows how to process. The list can be used by the client browser to limit the set of file options that is made available for selection. By default, no content type list is sent. accesskey checkbox, file, hidden, image, img, link, multibox, password, radio, submit, text, textarea Specifies the keyboard character to be used to move focus immediately to this element. action form, link Specifies the logical name of a global action that contains the actual content-relative URI of the destination of this transfer. You must specify one of the following attributes: action, forward, href, or page. You can modify this hyperlink dynamically by adding the paramId or name attribute. [Required for form] align image Specifies the alignment for this image. Deprecated: This attribute is deprecated in HTML 4. The suggested alternative is to use CSS. Fore more details, see www.w3.org/TR/REC-html40/struct/objects.html#h-13.7.4.
align img Specifies how the image is aligned, one of the following values:
- left
- Left-justifies, wrapping text on the right
- right
- Right-justifies, wrapping text on the 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
alt checkbox, file. hidden, image, img, multibox, password, radio, select, submit, text, textarea Specifies alternate text for a component. This alternate text serves as content when the element cannot be rendered normally, for example, if the browser does not support forms or is set so that it does not display images. altKey checkbox, file, hidden, image, img, multibox, password, radio, select, submit, text, textarea Specifies the message resources key of the alternate text for this element. anchor link, include, rewrite Specifies an optional anchor tag to be added to the generated hyperlink. Do not specify a number sign (#) in the attribute value. anchor redirect Specifies an optional anchor tag (xxx) to be added as #xxx to the generated hyperlink. arg0 message Specifies the first parametric replacement value, if any. arg1 message Specifies the second parametric replacement value, if any. arg2 message Specifies the third parametric replacement value, if any. arg3 message Specifies the fourth parametric replacement value, if any. arg4 message Specifies the fifth parametric replacement value, if any. border image, img Specifies the width (in pixels) of the border around this image. bundle message, write Specifies the name of the application scope bean under which the MessageResources object that contains messages is stored. The default is Globals.MESSAGES_KEY. bundle errors, image, img, messages, option Specifies the servlet context attribute key for the MessageResources instance to use. It defaults to the application resources that is configured for the action servlet. cdata javascript If set to true and XHTML has been enabled, wraps the JavaScript code in a CDATA section to prevent XML parsing. The default is true to comply with the W3C's recommendation. collection options Specifies the name of the JSP bean (in some scope), which is 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. collection iterate Specifies a run-time expression that evaluates to a collection (conforming to particular requirements) to be iterated over. cols textarea Specifies the number of columns to display. cookie equal, greaterEqual, greaterThan, lessEqual, lessThan, notEqual, notMatch, notPresent, present Specifies the name of a cookie whose value is to be compared with the value of the value attribute. disabled checkbox, file, image, option, multibox, password, radio, select, submit, text, textarea If set to true, disables the input field. dynamicJavascript javascript If set to false, does not render dynamic JavaScript code. The default is true. enctype form Specifies the content encoding to be used to submit this form, if the method is POST. You must set this to multipart/form-data if you are using the file tag to enable file upload. If you omit this attribute, the browser default (normally application/x-www-form-urlencoded) is used. filter write If set to false, suppresses filtering of the rendered property value for characters that are sensitive in HTML. By default, such values are converted to their entity equivalents. filter options, optionsCollection If set to false, suppresses filtering of option labels for sensitive characters in HTML. By default, such values are converted to their entity equivalents. focus form Specifies the field name (among the fields on this form) to which initial focus will be assigned with a JavaScript function. If you omit this attribute, no special JavaScript code for this purpose will be rendered. focusIndex form If the focus field is a field array, such as a radio button group, specifies the index in the array to receive focus. footer messages Specifies an optional message resource key that will be printed after the iteration of messages has finished. format write Specifies the format string to use to convert a bean or property value to the String object. By default, the format string for value data type will be searched in message resources according to key. formatKey write Specifies the key to be used to search a format string in application resources. formName javascript Specifies the key (form name) to retrieve a specific set of validation rules. forward include, rewrite Specifies the logical name of a global ActionForward class that contains the actual content-relative URI of the destination of this transfer. You must specify one of the following attributes: action, forward, href, or page. You can modify this hyperlink dynamically by adding the paramId or name attribute. forward redirect Specifies the logical name of a global ActionForward class that contains the actual content-relative URI of the destination of this redirect element. You can modify the URI modified dynamically by including query parameters, as described in the tag description. You must specify exactly one of the following attributes: forward, href, linkName, or page. frameborder frame If set to 1, generates a frame border around this frame. The default is 0. frameName frame Specifies a value for the name attribute of the rendered frame element. header messages Specifies an optional message resource key that will be printed before the iteration of the messages begins. header equal, greaterEqual, greaterThan, lessEqual, lessThan, notEqual, notMatch, notPresent, present Specifies the name of the header whose value is to be compared. The name match is performed in a case-insensitive manner. height img Specifies the height of the image being displayed. Specifying this attribute along with along with width helps the browser render the page faster. href link, include, rewrite Specifies the URL to which this hyperlink will transfer control if activated. You must specify one of the following attributes: action, forward, href, or page. You can modify this hyperlink dynamically by adding the paramId or name attribute. href redirect Specifies the URL to which this element will transfer control. You can modify the URL dynamically by the including query parameters as described in the tag description. You must specify exactly one of the following attributes: forward, href, linkName, or page. hspace img Specifies the amount of horizontal spacing between the image and the text. The text may be in the same paragraph or be wrapped around the image. htmlComment javascript Specifies whether or not to enclose the JavaScript code with HTML comments. This attribute is ignored in XHTML mode, because the script would be deleted by the XML parser. For details on hiding scripts from XML parsers, see the cdata attribute. The default is true. id define 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] id messages Specifies the required 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] id iterate Specifies 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] idName radio Specifies the name of the bean (in some scope) that will return the value of the radio tag. When the idName attribute, usually exposed by an iterator, 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. ignore write If set to true and the bean specified by the name and scope attributes does not exist, returns without writing anything. If set to false and the bean does not exist, throws a run-time exception. imageName img Specifies a name to be defined within this page so that you can reference it from scripts within the page. The value that you specify here will be the value of the name attribute in the generated img element. indexed checkbox, file, hidden, image, password, radio, select, submit, text, textarea Valid only inside an logic:iterate tag. If true, renders the name of the html tag as propertyName[int], where int will be generated for every iteration and taken from the ancestor logic:iterate tag. indexed link Valid only inside an logic:iterate tag. If true, adds the indexed parameter with name from indexId attribute to the query string. The indexed parameter looks like index[int], where int will be generated for every iteration and taken from the ancestor logic:iterate tag. indexId link Specifies a different name for the indexed parameter. For more information, see the indexed attribute. indexId iterate Specifies the name of a page scope JSP bean that will contain the current index of the collection on each iteration. ismap img Specifies the name of the server-side map to which this image belongs. key message Specifies the message key of the requested message, which must have a corresponding value in the message resources. By default, the key is obtained from the name and property attributes. key option 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. The default is to take from the body content of this tag the text to be displayed. label optionsCollection Specifies the property of the bean within the collection which represents the label to be rendered for each option. The default is label. labelName options Specifies the name of the JSP bean (in some scope) that contains the collection of labels to be displayed to the user for these options. labelProperty options Specifies the 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. length iterate Specifies 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. By default, the number of iterations performed is not limited. linkName link Specifies the anchor name to be defined within this page so that hyperlinks within the page can reference it. The value that you specify here will be the value of the name attribute in the generated anchor tag. locale message, write Specifies the name of the session scope bean under which our currently selected Locale object is stored. The default is Globals.LOCALE_KEY. locale errors, image, img, messages, option Specifies the value of the request or session locale attribute to be used to look up internationalized messages. locale html If set to true stores a locale in the session based on the current request's Accept-Language header (if any) if none has currently been set. This attribute creates a session if one does not already exist. The lang attribute is assigned the appropriate language code. Deprecated: Creating a session is undesirable for applications that do not support them. Use the lang attribute to achieve the same result without creating a session.
longdesc frame Specifies the URI of a long description of the frame. This description supplements the short description provided by the title attribute and may be particularly useful for nonvisual user agents. lowsrc img Specifies an image for users who have low-resolution graphics cards. Deprecated: This attribute is not defined in the HTML 4.01 specification and will be removed in a future version of Struts.
marginheight frame Specifies the amount of space (in pixels) to be left between the frame's contents and its top and bottom margins. marginwidth frame Specifies the amount of space (in pixels) to be left between the frame's contents and its left and right margins. maxlength file, password, text Specifies the maximum number of input characters to accept. message messages If set to true, retrieves the bean from the Globals.MESSAGE_KEY constant string and ignores any value assigned to the name attribute. By default the tag retrieves from the Globals.ERROR_KEY constant string the bean over which it will iterate. message messagesNotPresent, messagesPresent If set to true, retrieves the request scope bean from the Globals.MESSAGE_KEY constant string and ignores any value assigned to the name attribute. By default the tag retrieves from the Globals.ERROR_KEY constant string the request scope bean over which it will iterate. method form, javascript Specifies the HTTP method (GET or POST) that will be used to submit this request. multiple select Specifies the maximum number of input characters to accept. name define 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. name message Specifies the attribute name of the bean whose property is accessed to retrieve the value specified by property (if specified). If you omit property, the value of this bean itself will be used as the message resource key. name checkbox, errors, file, form, hidden, img, link, messages, multibox, options, password, radio, rewrite, select, text, textarea, include Specifies the name of a JSP bean that contains a map that represents 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). name optionsCollection Specifies the attribute name of the bean whose properties are consulted when rendering the current value of this input field. By default, the bean associated with the form tag within which this element is nested is utilized. name equal, greaterEqual, greaterThan, lessEqual, lessThan, notEqual Specifies a JSP bean as the variable to be compared, if you omit property, or the value of the specified property of this bean, if you specify property. name forward Specifies 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. [Required]
name iterate Specifies the name of the JSP bean that contains the collection to be iterated (if you omit property), or the JSP bean whose property getter returns the collection to be iterated (if you specify property). name match, notMatch Specifies the variable to be matched is the JSP bean specified by this attribute, if you omit property, or the value of the specified property of this bean, if you specify property. name messagesNotPresent, messagesPresent Specifies the parameter key to retrieve the message from request scope. name notPresent, present Checks for the existence of a JSP bean, in any scope, with the specified name. If you also specify property, name checks for a nonnull property value for the specified property. name redirect Specifies the name of a JSP bean that contains a Map class that represents the query parameters (if you omit property), or a JSP bean whose property getter is called to return a Map (if you specify property). noresize frame If set to true, prevents users from resizing the frame. The default is false. offset iterate Specifies the zero-relative index of the starting point from which entries from the underlying collection will be iterated. 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. The default value is zero, which means that the collection will be iterated from the beginning. onblur checkbox, file, image, link, multibox, password, radio, select, submit, text, textarea Runs the JavaScript event handler when this element loses input focus. onchange checkbox, file, image, multibox, password, radio, select, submit, text, textarea Runs the JavaScript event handler when this element loses input focus and its value has changed. onclick checkbox, file, image, link, link, multibox, password, radio, select, submit, text, textarea Runs the JavaScript event handler when this element receives a mouse click. ondblclick checkbox, file, image, link, multibox, password, radio, select, submit, text, textarea Runs the JavaScript event handler when this element receives a mouse double-click. onfocus checkbox, file, image, link, multibox, password, radio, select, submit, text, textarea Runs the JavaScript event handler when this element receives input focus. onkeydown checkbox, file, image, img, link, multibox, password, radio, select, submit, text, textarea Runs the JavaScript event handler when this element has focus and a key is depressed. onkeypress checkbox, file, image, img, link, multibox, password, radio, select, submit, text, textarea Runs the JavaScript event handler when this element has focus and a key is depressed and released. onkeyup checkbox, file, image, img, link, multibox, password, radio, select, submit, text, textarea Runs the JavaScript event handler when this element has focus and a key is released. onmousedown checkbox, file, image, link, multibox, password, radio, select, submit, text, textarea Runs the JavaScript event handler when this element is under the mouse pointer and a mouse button is depressed. onmousemove checkbox, file, image, link, multibox, password, radio, select, submit, text, textarea Runs the JavaScript event handler when this element is under the mouse pointer and the pointer is moved. onmouseout checkbox, file, image, link, multibox, password, radio, select, submit, text, textarea Runs the JavaScript event handler when this element was under the mouse pointer but the pointer was moved outside the element. onmouseover checkbox, file, image, link, multibox, password, radio, select, submit, text, textarea Runs the JavaScript event handler when this element was not under the mouse pointer but the pointer is moved inside the element. onmouseup checkbox, file, image, link, multibox, password, radio, select, submit, text, textarea Runs the JavaScript event handler when this element is under the mouse pointer and a mouse button is released. onreset form Runs the JavaScript event handler if the form is reset. onsubmit form Runs the JavaScript event handler if the form is submitted. page image, img, javascript, link, include, rewrite Specifies the module-relative path, beginning with a slash (/), to which this hyperlink, if activated, will transfer control. You must specify one of the following attributes: action, forward, href, or page. You can modify this hyperlink dynamically by adding the paramId or name attribute. page redirect Specifies the context-relative path (beginning with a / character) to which this hyperlink will transfer control if activated. You can modify the hyperlink dynamically by including query parameters as described in the tag description. You must specify exactly one of the following attributes: forward, href, linkName, or page. pageKey image, img Specifies the key of the message resources string that specifies the module-relative path of the image for this input tag. parameter equal, greaterEqual, greaterThan, lessEqual, lessThan, notEqual, notMatch, notPresent, present Specifies the name of the URL request parameter whose value is to be compared with the value of the value attribute. paramId img, link, rewrite, redirect Specifies the name of the request parameter that will be added dynamically to the generated hyperlink. The corresponding value is defined by the paramName and (optional) paramProperty attributes and is optionally scoped by the paramScope attribute. paramName img, link, rewrite, redirect Specifies the name of a JSP bean that is a String containing the value for the request parameter named by paramId (if you omit paramProperty), or a JSP bean whose property getter is called to return a String (if you specify paramProperty). The JSP bean is constrained to the bean scope specified by the paramScope property, if it is specified. paramProperty img, link, rewrite, redirect Specifies 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 added dynamically to this hyperlink. paramScope img, link, rewrite, redirect Specifies the scope within which to search for the bean specified by the paramName attribute. By default, all scopes are searched. property define, hidden Specifies the name of the property to be accessed on the bean specified by name. This value can be a simple, indexed, or nested property reference expression. By default, the bean identified by name is given a new reference identified by id. property message Specifies the name of the property to be accessed on the bean specified by name. This value can be a simple, indexed, or nested property reference expression. By default, the value of the bean identified by name will itself be used as the message resource key. property write Specifies the name of the property to be accessed on the bean specified by name. This value can be a simple, indexed, or nested property reference expression. By default, the bean identified by name will itself be rendered. If the specified property returns null, no output will be rendered. property checkbox, file, multibox, password, select Specifies the name of the request parameter that will be included with this submission, set to the specified value. [Required] property cancel Specifies the name of the request parameter that will be included with this submission, set to the specified value. Attention: 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 cancellation detection.property errors Specifies the name of the property for which error messages should be displayed. By default, all error messages (regardless of property) are displayed. property img, link, rewrite Specifies the name of a property of the bean specified by the name attribute, whose return value must be a java.util.Map class that contains the query parameters to be added to the hyperlink. If you specify this attribute, also specify the name attribute. property hidden Specifies the 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] property image Specifies 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=""). property messages Specifies the name of the property for which messages should be displayed. By default, all messages (regardless of property) are displayed. property options Specifies the property of the form bean, or the bean specified by the name attribute, that will return the collection of valuesreturned to the server for these options. property radio Specifies the corresponding bean property for this radio tag. [Required] property reset Specifies the name of the input field that will be generated. property text, textarea Specifies the 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] property empty, equal, greaterEqual, iterate, messagesNotPresent, messagesPresent, notEqual, notPresent, present, redirect Specifies the name of the property (of the bean specified by the name attribute) whose value is to be compared. The property reference can be simple, nested, or indexed. readonly password, text, textarea If set to true, makes this input field read-only. redisplay password If set to false, indicates that existing values will not be redisplayed. Even though a redisplayed value is shown as asterisks on the visible HTML page, the clear text of the actual password value is visible though the Show Page Source menu option of the client browser. The default is true. You may wish to set the value to false on login pages. role notPresent, present Checks whether the currently authenticated user (if any) has been associated with any of the specified security roles. To specify multiple roles, separate the role names with commas. rows textarea Specifies the number of rows to display. scope define, message, write Specifies the variable scope that to be searched to retrieve the bean specified by name. By default, the default rules applied by PageContext.findAttribute() are applied. scope frame, img, link, rewrite Specifies the scope within which to search for the bean specified by the name attribute. By default, all scopes are searched. scope equal, greaterEqual, greaterThan, lessEqual, lessThan, notEqual, notMatch, notPresent, present Specifies the bean scope within which to search for the bean named by the name property. The default is to use any scope. scrolling frame Specifies whether scroll bars are to be created unconditionally (yes), never (no), or only when needed (auto). server base Specifies the server name to use instead of request.getServerName(). size file, password, select, text Specifies the number of character positions to allocate. src image, img, javascript Specifies the source URL of the image for this input tag. srcKey image, img Specifies the key of the message resources string that specifies the source URL of the image for this input tag. staticJavascript javascript Specifies whether or not to render the static JavaScript code. The default is true. style checkbox, file, form, image, img, link, multibox, option, options, optionsCollection, password, radio, select, submit, text, textarea Specifies CSS style information for the component (for example, style="font-size : 8pt ; color : red"). styleClass checkbox, file, form, image, img, link, multibox, option, options, optionsCollection, password, radio, select, submit, text, textarea Specifies the CSS stylesheet class to be applied to this HTML element. This creates a class attribute. styleId checkbox, file, form, img, link, multibox, option, password, radio, select, submit, text, textarea Specifies an identifier to be assigned to this HTML element. This creates an id attribute. tabindex checkbox, file, image, link, multibox, password, radio, select, submit, text, textarea Sets the tab order (ascending positive integers) for this element. target base, form, link Specifies a Window target to which this form is submitted, such as for use in framed presentations. title checkbox, file, hidden, image, img, link, multibox, password, radio, select, submit, text, textarea Specifies the advisory title for this element. titleKey checkbox, file, hidden, image, img, link, multibox, password, radio, select, submit, text, textarea Specifies the message resources key for the advisory title for this element. toScope define Specifies the variable scope into which the newly defined bean will be created. By default, the bean is created in page scope. transaction link, include, rewrite If set to true, includes in the generated hyperlink any current transaction control token, so that it will pass an isTokenValid() test in the receiving action. transaction redirect If set to true, includes the current transaction control token in the generated URL for this element. type define, form Specifies the fully qualified class name of the value to be exposed as the id attribute. The default is java.lang.String if you specify a value attribute or java.lang.Object otherwise. type iterate Specifies the fully qualified Java class name of the element to be exposed through the JSP bean named from the id attribute. By default, no type conversions are performed. Note: The actual elements of the collection must be assignment-compatible with this class, or a request time ClassCastException error will occur,
usemap img Specifies the name of the map as defined within this page for mapping hot-spot areas of this image. user notPresent, present Checks whether the currently authenticated user has the specified name. value define Specifies the java.lang.String value to which the exposed bean should be set. This attribute is required unless you specify the name attribute or nested body content. value image, password, radio, submit Specifies the value of the label to be placed on this button. This value will also be submitted as the value of the specified request parameter. value checkbox, multibox Specifies the value to be transmitted if this check box is checked when the form is submitted. By default, the value on is returned if the check box is checked. value file, hidden, text, textarea Specifies the value to which this field should be initialized. value option Specifies the value to be submitted for this field if this option is selected by the user. [Required] value optionsCollection Specifies the property of the bean within the collection which represents the value to be rendered for each option. The default is value. value select Specifies the value to compare with for marking an option selected. value equal, greaterEqual, greaterThan, lessEqual, lessThan, notEqual Specifies the constant value to which the variable, specified by other attributes of this tag, will be compared. vspace img Specifies the amount of vertical spacing between the image and the text, above and below. width img Specifies the width of the image being displayed. Specifying this attribute along with along with height helps the browser render the page faster. write hidden If set to true, renders the value of this field 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. xhtml html If set to true, renders xml:lang and xmlns attributes on the generated html element. This also causes all other html tags to render as XHTML 1.0. (The <html:xhtml/> tag has a similar purpose.)
Related tasks
Adding Struts tags to a JSP file
Related reference
Feedback
Properties for Struts bean tags
Properties for Struts tiles tags
Properties for Struts HTML tags
Properties for Struts logic tags
Properties for Struts tags