html
Tag 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):

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 <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:

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:

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 <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 Classorg.apache.struts.taglib.html.LinkTag
TagExtraInfo ClassNone
Body ContentJSP
Display NameNone

Attributes
accesskey

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

 
Required: false
Request-time: false
Type: java.lang.String
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.

Additionally, you can specify a module prefix for linking to other modules.

 
Required: false
Request-time: false
Type: java.lang.String
module

Prefix name of a Module that contains the action mapping for the Action that is specified by the action attribute. You must specify an action attribute for this to have an effect.

Note: Use "" to map to the default module.

 
Required: false
Request-time: false
Type: java.lang.String
anchor

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

 
Required: false
Request-time: false
Type: java.lang.String
dir

The direction for weak/neutral text for this element.

Since:
Struts 1.3.6
 
Required: false
Request-time: false
Type: java.lang.String
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.

 
Required: false
Request-time: false
Type: java.lang.String
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.

 
Required: false
Request-time: false
Type: java.lang.String
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.
 
Required: false
Request-time: false
Type: java.lang.String
indexId
By this attribute different name for the indexed parameter can be specified. Take a look to the "indexed" attribute for details.
 
Required: false
Request-time: false
Type: java.lang.String
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.
Since:
Struts 1.2.5
 
Required: false
Request-time: false
Type: java.lang.String
lang

The language code for this element.

Since:
Struts 1.3.6
 
Required: false
Request-time: false
Type: java.lang.String
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.

 
Required: false
Request-time: false
Type: java.lang.String
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).

 
Required: false
Request-time: false
Type: java.lang.String
onblur

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

 
Required: false
Request-time: false
Type: java.lang.String
onclick

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

 
Required: false
Request-time: false
Type: java.lang.String
ondblclick

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

 
Required: false
Request-time: false
Type: java.lang.String
onfocus

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

 
Required: false
Request-time: false
Type: java.lang.String
onkeydown

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

 
Required: false
Request-time: false
Type: java.lang.String
onkeypress

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

 
Required: false
Request-time: false
Type: java.lang.String
onkeyup

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

 
Required: false
Request-time: false
Type: java.lang.String
onmousedown

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

 
Required: false
Request-time: false
Type: java.lang.String
onmousemove

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

 
Required: false
Request-time: false
Type: java.lang.String
onmouseout

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

 
Required: false
Request-time: false
Type: java.lang.String
onmouseover

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

 
Required: false
Request-time: false
Type: java.lang.String
onmouseup

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

 
Required: false
Request-time: false
Type: java.lang.String
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.

 
Required: false
Request-time: false
Type: java.lang.String
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

 
Required: false
Request-time: false
Type: java.lang.String
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.

 
Required: false
Request-time: false
Type: java.lang.String
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.

 
Required: false
Request-time: false
Type: java.lang.String
paramScope

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

 
Required: false
Request-time: false
Type: java.lang.String
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.

 
Required: false
Request-time: false
Type: java.lang.String
scope

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

 
Required: false
Request-time: false
Type: java.lang.String
style

CSS styles to be applied to this element.

 
Required: false
Request-time: false
Type: java.lang.String
styleClass
CSS stylesheet class to be applied to this HTML element (renders a "class" attribute).
 
Required: false
Request-time: false
Type: java.lang.String
styleId
Identifier to be assigned to this HTML element (renders an "id" attribute).
 
Required: false
Request-time: false
Type: java.lang.String
tabindex

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

 
Required: false
Request-time: false
Type: java.lang.String
target

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

 
Required: false
Request-time: false
Type: java.lang.String
title

The advisory title for this hyperlink.

 
Required: false
Request-time: false
Type: java.lang.String
titleKey

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

 
Required: false
Request-time: false
Type: java.lang.String
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.

 
Required: false
Request-time: false
Type: java.lang.String
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.

 
Required: false
Request-time: false
Type: java.lang.String

Variables
No Variables Defined.


Output Generated by Tag Library Documentation Generator. Java, JSP, and JavaServer Pages are trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries. Copyright 2002-4 Sun Microsystems, Inc. 4150 Network Circle Santa Clara, CA 95054, U.S.A. All Rights Reserved.