Attributes for Struts logic tags

This reference material describes the attributes for the Struts logic tag library. By default, each element name has a logic: prefix.

For more information about the Struts tags and tag attributes, refer to the Apache Struts specifications.

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

 

Empty

Table 1. Empty tag attributes
Attribute Description
name 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.

property 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.
scope Specifies the bean scope within which to search for the bean named by the

name property. The default is to use any scope.

Return to the top of the page.

 

Equal

Table 2. Equal tag attributes
Attribute Description
cookie Specifies the name of a cookie whose value is to be compared with the value of the

value attribute.

header Specifies the name of the header whose value is to be compared. The name match is performed in a case-insensitive manner.
name 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.

parameter Specifies the name of the URL request parameter whose value is to be compared with the value of the

value attribute.

property 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.
scope Specifies the bean scope within which to search for the bean named by the

name property. The default is to use any scope.

value Specifies the constant value to which the variable, specified by other attributes of this tag, will be compared.

Note: This is a required attribute.

Return to the top of the page.

 

Forward

Table 3. Forward tag attributes
Attribute Description
name 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.

Note: This is a required attribute.

Return to the top of the page.

 

Greater Equal

Table 4. Greater equal tag attributes
Attribute Description
cookie Specifies the name of a cookie whose value is to be compared with the value of the

value attribute.

header Specifies the name of the header whose value is to be compared. The name match is performed in a case-insensitive manner.
name 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.

parameter Specifies the name of the URL request parameter whose value is to be compared with the value of the

value attribute.

property 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.
scope Specifies the bean scope within which to search for the bean named by the

name property. The default is to use any scope.

value Specifies the constant value to which the variable, specified by other attributes of this tag, will be compared.

Note: This is a required attribute.

Return to the top of the page.

 

Greater Than

Table 5. Greater than tag attributes
Properties Description
cookie Specifies the name of a cookie whose value is to be compared with the value of the

value attribute.

header Specifies the name of the header whose value is to be compared. The name match is performed in a case-insensitive manner.
name 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.

parameter Specifies the name of the URL request parameter whose value is to be compared with the value of the

value attribute.

property 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.
scope Specifies the bean scope within which to search for the bean named by the

name property. The default is to use any scope.

value Specifies the constant value to which the variable, specified by other attributes of this tag, will be compared.

Note: This is a required attribute.

Return to the top of the page.

 

Iterate

Table 6. Iterate tag attributes
Attribute Description
collection Specifies a runtime expression that evaluates to a collection (conforming to particular requirements) to be iterated over.
id Specifies the name of a page scope JavaServer Pages (JSP) bean that will contain the current element of the collection on each iteration, if it is not null.

Note: This is a required attribute.

indexId Specifies the name of a page scope JSP bean that will contain the current index of the collection on each iteration.
length 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.

name 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).

offset 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.

property 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.
scope Specifies the bean scope within which to search for the bean named by the

name property. The default is to use any scope.

type 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.

Return to the top of the page.

 

Less Equal

Table 7. Less equal tag attributes
Attribute Description
cookie Specifies the name of a cookie whose value is to be compared with the value of the

value attribute.

header Specifies the name of the header whose value is to be compared. The name match is performed in a case-insensitive manner.
name 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.

parameter Specifies the name of the URL request parameter whose value is to be compared with the value of the

value attribute.

property 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.
scope Specifies the bean scope within which to search for the bean named by the

name property. The default is to use any scope.

value Specifies the constant value to which the variable, specified by other attributes of this tag, will be compared.

Note: This is a required attribute.

Return to the top of the page.

 

Less Than

Table 8. Less than tag attributes
Attribute Description
cookie Specifies the name of a cookie whose value is to be compared with the value of the

value attribute.

header Specifies the name of the header whose value is to be compared. The name match is performed in a case-insensitive manner.
name 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.

parameter Specifies the name of the URL request parameter whose value is to be compared with the value of the

value attribute.

property 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.
scope Specifies the bean scope within which to search for the bean named by the

name property. The default is to use any scope.

value Specifies the constant value to which the variable, specified by other attributes of this tag, will be compared.

Note: This is a required attribute.

Return to the top of the page.

 

Match

Table 9. Match tag attributes
Attribute Description
cookie Specifies the name of a cookie whose value is to be compared with the value of the

value attribute.

header Specifies the name of the header whose value is to be compared. The name match is performed in a case-insensitive manner.
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.
name 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.

parameter Specifies the name of the URL request parameter whose value is to be compared with the value of the

value attribute.

property 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.
scope Specifies the bean scope within which to search for the bean named by the

name property. The default is to use any scope.

value Specifies the constant value to which the variable, specified by other attributes of this tag, will be compared.

Note: This is a required attribute.

Return to the top of the page.

 

Message Not Present

Table 10. Message not present tag attributes
Attribute Description
message 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.

name Specifies the parameter key to retrieve the message from request scope.
property 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.

Return to the top of the page.

 

Message Present

Table 11. Message present tag attributes
Attribute Description
message 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.

name Specifies the parameter key to retrieve the message from request scope.
property 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.

Return to the top of the page.

 

Not Empty

Table 12. Not empty tag attributes
Attribute Description
name Checks for the existence of a JSP bean, in any scope, with the specified name. If you also specify

property,

name checks for a non-null property value for the specified property.

property 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.
scope Specifies the bean scope within which to search for the bean named by the

name property. The default is to use any scope.

Return to the top of the page.

 

Not Equal

Table 13. Not equal tag attributes
Attribute Description
cookie Specifies the name of a cookie whose value is to be compared with the value of the

value attribute.

header Specifies the name of the header whose value is to be compared. The name match is performed in a case-insensitive manner.
name 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.

parameter Specifies the name of the URL request parameter whose value is to be compared with the value of the

value attribute.

property 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.
scope Specifies the bean scope within which to search for the bean named by the

name property. The default is to use any scope.

value Specifies the constant value to which the variable, specified by other attributes of this tag, will be compared.

Note: This is a required attribute.

Return to the top of the page.

 

Not Match

Table 14. Not match tag attributes
Attribute Description
cookie Specifies the name of a cookie whose value is to be compared with the value of the

value attribute.

header Specifies the name of the header whose value is to be compared. The name match is performed in a case-insensitive manner.
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.
name 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.

parameter Specifies the name of the URL request parameter whose value is to be compared with the value of the

value attribute.

property 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.
scope Specifies the bean scope within which to search for the bean named by the

name property. The default is to use any scope.

value Specifies the constant value to which the variable, specified by other attributes of this tag, will be compared.

Note: This is a required attribute.

Return to the top of the page.

 

Not Present

Table 15. Not present tag attributes
Attribute Description
cookie Specifies the name of a cookie whose value is to be compared with the value of the

value attribute.

header Specifies the name of the header whose value is to be compared. The name match is performed in a case-insensitive manner.
name 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.

parameter Specifies the name of the URL request parameter whose value is to be compared with the value of the

value attribute.

property 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.
scope Specifies the bean scope within which to search for the bean named by the

name property. The default is to use any scope.

value Specifies the constant value to which the variable, specified by other attributes of this tag, will be compared.

Return to the top of the page.

 

Present

Table 16. Present tag attributes
Attribute Description
cookie Specifies the name of a cookie whose value is to be compared with the value of the

value attribute.

header Specifies the name of the header whose value is to be compared. The name match is performed in a case-insensitive manner.
name Checks for the existence of a JSP bean, in any scope, with the specified name. If you also specify

property,

name checks for a non-null property value for the specified property.

parameter Specifies the name of the URL request parameter whose value is to be compared with the value of the

value attribute.

property 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.
role 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.
scope Specifies the bean scope within which to search for the bean named by the

name property. The default is to use any scope.

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

Return to the top of the page.

 

Redirect

Table 17. Redirect tag attributes
Attribute 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.
anchor Specifies an optional anchor tag (xxx) to be added as #xxx to the generated hyperlink.
forward 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.

href 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.

name 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).

page 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.

paramId 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 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 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 Specifies the scope within which to search for the bean specified by the

paramName attribute. By default, all scopes are searched.

property 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.
scope Specifies the bean scope within which to search for the bean named by the

name property. The default is to use any scope.

transaction If set to

true, includes the current transaction control token in the generated URL for this element.

useLocalEncoding If set to true, LocalCharacterEncoding will be used, that is, the characterEncoding set to the HttpServletResponse, as prefered character encoding rather than UTF-8, when URLEncoding is done on parameters of the URL.

Return to the top of the page.