Home > Guides > Tag Developers Guide > Struts Tags > Tag Reference > Generic Tag Reference > a

Description

A tag that creates a HTML <a >.This tag supports the same attributes as the "url" tag, including nested parameters using the "param" tag.

While this tag can be used with the simple theme, xhtml theme, and others, it is really designed to work best with the ajax theme. We recommend reading the ajax a template documentation for more details.

Parameters

Dynamic Attributes Allowed:

true
 

Name

Required

Default

Evaluated

Type

Description

accesskeyfalsefalseStringSet the html accesskey attribute on rendered html element
actionfalsefalseStringThe action to generate the URL for, if not using value
anchorfalsefalseStringThe anchor for this URL
classfalsefalseStringThe css class to use for element - it's an alias of cssClass attribute.
cssClassfalsefalseStringThe css class to use for element
cssErrorClassfalsefalseStringThe css error class to use for element
cssErrorStylefalsefalseStringThe css error style definitions for element to use
cssStylefalsefalseStringThe css style definitions for element to use
disabledfalsefalseStringSet the html disabled attribute on rendered html element
encodefalsetruefalseBooleanWhether to encode parameters
errorPositionfalsefalseStringDefine error position of form element (top|bottom)
escapeAmpfalsetruefalseBooleanSpecifies whether to escape ampersand (&) to (&amp or not
forceAddSchemeHostAndPortfalsefalsefalseBooleanSpecifies whether to force the addition of scheme, host and port or not
hreffalsefalseStringThe URL.
idfalsefalseStringHTML id attribute
includeContextfalsetruefalseBooleanWhether actual context should be included in URL
includeParamsfalsenonefalseStringThe includeParams attribute may have the value 'none', 'get' or 'all'
javascriptTooltipfalsefalsefalseBooleanUse JavaScript to generate tooltips
keyfalsefalseStringSet the key (name, value, label) for this particular component
labelfalsefalseStringLabel expression used for rendering an element specific label
labelSeparatorfalse:falseStringString that will be appended to the label
labelpositionfalsefalseStringDefine label position of form element (top/left)
methodfalsefalseStringThe method of action to use
namefalsefalseStringThe name to set for element
namespacefalsefalseStringThe namespace to use
onblurfalsefalseString Set the html onblur attribute on rendered html element
onchangefalsefalseStringSet the html onchange attribute on rendered html element
onclickfalsefalseStringSet the html onclick attribute on rendered html element
ondblclickfalsefalseStringSet the html ondblclick attribute on rendered html element
onfocusfalsefalseStringSet the html onfocus attribute on rendered html element
onkeydownfalsefalseStringSet the html onkeydown attribute on rendered html element
onkeypressfalsefalseStringSet the html onkeypress attribute on rendered html element
onkeyupfalsefalseStringSet the html onkeyup attribute on rendered html element
onmousedownfalsefalseStringSet the html onmousedown attribute on rendered html element
onmousemovefalsefalseStringSet the html onmousemove attribute on rendered html element
onmouseoutfalsefalseStringSet the html onmouseout attribute on rendered html element
onmouseoverfalsefalseStringSet the html onmouseover attribute on rendered html element
onmouseupfalsefalseStringSet the html onmouseup attribute on rendered html element
onselectfalsefalseStringSet the html onselect attribute on rendered html element
openTemplatefalsefalseStringSet template to use for opening the rendered html.
portletModefalsefalseStringThe resulting portlet mode
portletUrlTypefalsefalseStringSpecifies if this should be a portlet render or action URL. Default is "render". To create an action URL, use "action".
requiredLabelfalsefalsefalseBooleanIf set to true, the rendered element will indicate that input is required
requiredPositionfalsefalseStringDefine required position of required form element (left|right)
schemefalsefalseStringSet scheme attribute
stylefalsefalseStringThe css style definitions for element to use - it's an alias of cssStyle attribute.
tabindexfalsefalseStringSet the html tabindex attribute on rendered html element
templatefalsefalseStringThe template (other than default) to use for rendering the element
templateDirfalsefalseStringThe template directory.
themefalsefalseStringThe theme (other than default) to use for rendering the element
titlefalsefalseStringSet the html title attribute on rendered html element
tooltipfalsefalseStringSet the tooltip of this particular component
tooltipConfigfalsefalseStringDeprecated. Use individual tooltip configuration attributes instead.
tooltipCssClassfalseStrutsTTClassicfalseStringCSS class applied to JavaScrip tooltips
tooltipDelayfalseClassicfalseStringDelay in milliseconds, before showing JavaScript tooltips
tooltipIconPathfalsefalseStringIcon path used for image that will have the tooltip
valuefalsefalseStringThe target value to use, if not using action
windowStatefalsefalseStringThe resulting portlet window state

Usage

To get started, use the head tag and the ajax theme. See ajax head template for more information. Then look at the usage details for the ajax a template.

 
If you want to use additional parameters in your s:a the best practice is to use a s:url to create your url and then leverage this url into your s:a tag. This is done by creating a s:url and specifying an id attribute.. like "testUrlId" in this example. Then in the s:a tag reference this id in the href attribute via " %{testUrlId}"

<s:url var="testUrlId" namespace="/subscriber" action="customField" method="delete">
    <s:param name="customFieldDefinition.id" value="${id}"/>
</s:url>
<s:a errorText="Sorry your request had an error." preInvokeJS="confirm('Are you sure you want to delete this item?')" href="%{testUrlId}">
    <img src="<s:url value="/images/delete.gif"/>" border="none"/>
</s:a>

<img xsrc="<s:url value="/images/delete.gif"/>" border="none"/><s:a><img xsrc="<s:url value="/images/delete.gif"/>" border="none"/></s:a>