| |||||||
FRAMES NO FRAMES |
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):
ActionForward
to be looked up, and use the module-relative or context-relative URI found there. If the forward is module-relative then it must point to an action and NOT to a page.Action
to be looked up, and use the module-relative or context-relative URI found there.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 three 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, or nest one or more lt&;html:param> tags in the tag body.
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:
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.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:
name
attribute - The named JSP bean (optionally scoped by the value of the scope
attribute) must identify a java.util.Map
containing the parameters.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.
Supplmenting these two methods, you can nest one or more lt&;html:param> tags to dynamically add parameters in a logic-friendly way (such as executing a for loop that assigns the name/value pairs at runtime). This method does not compete with the aforementioned; it will adds its parameters in addition to whatever parameters are already specified.
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.
Tag Information | |
Tag Class | org.apache.struts.taglib.html.LinkTag |
TagExtraInfo Class | None |
Body Content | JSP |
Display Name | None |
Attributes | ||||
Name | Required | Request-time | Type | Description |
accesskey | false | true | java.lang.String | The keyboard character used to move focus immediately to this element. |
action | false | true | java.lang.String | Logical name of a Additionally, you can specify a |
module | false | true | java.lang.String | Prefix name of a Note: Use "" to map to the default module. |
anchor | false | true | java.lang.String | Optional anchor tag ("#xxx") to be added to the generated hyperlink. Specify this value without any "#" character. |
dir | false | true | java.lang.String | The direction for weak/neutral text for this element.
|
forward | false | true | java.lang.String | Logical name of a global |
href | false | true | java.lang.String | 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 |
indexed | false | true | boolean | 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. |
indexId | false | true | java.lang.String | By this attribute different name for the indexed parameter can be specified. Take a look to the "indexed" attribute for details. |
bundle | false | true | java.lang.String | The servlet context attributes key for the MessageResources instance to use. If not specified, defaults to the application resources configured for our action servlet.
|
lang | false | true | java.lang.String | The language code for this element.
|
linkName | false | true | java.lang.String | 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. |
name | false | true | java.lang.String | The name of a JSP bean that contains a |
onblur | false | true | java.lang.String | JavaScript event handler that is executed when this element loses input focus. |
onclick | false | true | java.lang.String | JavaScript event handler that is executed when this element receives a mouse click. |
ondblclick | false | true | java.lang.String | JavaScript event handler that is executed when this element receives a mouse double click. |
onfocus | false | true | java.lang.String | JavaScript event handler that is executed when this element receives input focus. |
onkeydown | false | true | java.lang.String | JavaScript event handler that is executed when this element receives a key down event. |
onkeypress | false | true | java.lang.String | JavaScript event handler that is executed when this element receives a key press event. |
onkeyup | false | true | java.lang.String | JavaScript event handler that is executed when this element receives a key up event. |
onmousedown | false | true | java.lang.String | JavaScript event handler that is executed when this element receives a mouse down event. |
onmousemove | false | true | java.lang.String | JavaScript event handler that is executed when this element receives a mouse move event. |
onmouseout | false | true | java.lang.String | JavaScript event handler that is executed when this element receives a mouse out event. |
onmouseover | false | true | java.lang.String | JavaScript event handler that is executed when this element receives a mouse over event. |
onmouseup | false | true | java.lang.String | JavaScript event handler that is executed when this element receives a mouse up event. |
page | false | true | java.lang.String | 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 |
paramId | false | true | java.lang.String | The name of the request parameter that will be dynamically added to the generated hyperlink. The corresponding value is defined by the |
paramName | false | true | java.lang.String | The name of a JSP bean that is a String containing the value for the request parameter named by |
paramProperty | false | true | java.lang.String | The name of a property of the bean specified by the |
paramScope | false | true | java.lang.String | The scope within which to search for the bean specified by the |
property | false | true | java.lang.String | The name of a property of the bean specified by the |
scope | false | true | java.lang.String | The scope within which to search for the bean specified by the |
style | false | true | java.lang.String | CSS styles to be applied to this element. |
styleClass | false | true | java.lang.String | CSS stylesheet class to be applied to this HTML element (renders a "class" attribute). |
styleId | false | true | java.lang.String | Identifier to be assigned to this HTML element (renders an "id" attribute). |
tabindex | false | true | java.lang.String | The tab order (ascending positive integers) for this element. |
target | false | true | java.lang.String | The window target in which the resource requested by this hyperlink will be displayed, for example in a framed presentation. |
title | false | true | java.lang.String | The advisory title for this hyperlink. |
titleKey | false | true | java.lang.String | The message resources key for the advisory title for this element. |
transaction | false | true | boolean | If set to |
useLocalEncoding | false | true | boolean | If set to |
Variables | No Variables Defined. |
| |||||||
FRAMES NO FRAMES |