Anchor Class

com.bea.wlw.netui.tags.html
Anchor Class

public class Anchor

    extends AbstractBaseTag
    implements IAttributeConsumer, URLParams

Generates a hyperlink to a specified URI. Also adds support for URL re-writing and JavaScript-based form submission. An anchor must have one of five attributes to correctly create the hyperlink:

Attribute Descriptions
AttributeRequiredRuntime Expression Evaluation Data Bindable
accessKeyNoNoNo
Define the keyboard navigation key for the element.
actionNoNoRead Only
An action invoked by clicking the link.
formSubmitNoNoNo
True if clicking this link should submit its enclosing form.
forwardNoNoNo
The logical forward name from which to retrieve the hyperlink URI.
hrefNoNoRead Only
A URL destination to go to.
idNoNoNo
id is deprecated, use tagId. The id attribute of the generated Anchor. You should use the tagId which will encode the id correctly for containers such as the Portal which needs to rewrite id's to make them unique.
linkNameNoNoNo
An internal place in the page to move to.
locationNoNoNo
Location within the URI to visit
pageNoNoNo
page is deprecated The module-relative page URL to which this hyperlink will be rendered.
tagIdNoNoNo
The id of this anchor. The real id written to the HTML stream may be changed by the container (Portal), but may be looked up with the 'tagId' value through the JavaScript method getNetuiTagName( tag, tagId ) method written by the <netui:html> tag.
targetNoNoNo
The window target

Related Topics

<netui:anchor> Tag Sample
How Do I: Define an Action That Forwards Users to Another Page?
Form


Hierarchy
Object
  TagSupport
    BodyTagSupport
      AbstractBaseTag
        Anchor
All Implemented Interfaces

BodyTag, IAttributeConsumer, IterationTag, Serializable, Tag, URLParams
Direct Known Subclasses

ImageAnchor

Field Summary

public static final String
HREF
String
protected String
id
String
   
Fields from  com.bea.wlw.netui.tags.AbstractBaseTag
ATTR_GENERAL, ATTR_GENERAL_EXPRESSION, ATTR_JAVASCRIPT, ATTR_STYLE, CLASS, ID, JAVASCRIPT_STATUS, NAME, NETUI_UNIQUE_CNT, ONCLICK, ONDBLCLICK, ONKEYDOWN, ONKEYPRESS, ONKEYUP, ONMOUSEDOWN, ONMOUSEMOVE, ONMOUSEOUT, ONMOUSEOVER, ONMOUSEUP, STYLE, TABINDEX
 
Fields from  javax.servlet.jsp.tagext.BodyTagSupport
bodyContent
 
Fields from  javax.servlet.jsp.tagext.TagSupport
id, pageContext
 
Fields from interface javax.servlet.jsp.tagext.BodyTag
EVAL_BODY_BUFFERED, EVAL_BODY_TAG
 
Fields from interface javax.servlet.jsp.tagext.IterationTag
EVAL_BODY_AGAIN
 
Fields from interface javax.servlet.jsp.tagext.Tag
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE
 

Constructor Summary

Anchor()

 

Method Summary

public void
addParameter(String name, Object value)
Adds a URL parameter to the generated hyperlink.
protected void
createAnchorAttributes(UnsyncStringBuffer results)
Method which will write additional attributes into the anchor being created by the createAnchorBeginTag method.
protected boolean
createAnchorBeginTag(UnsyncStringBuffer results, UnsyncStringBuffer script, boolean encodeAction)
This method will take all of the internal variables and create an anchor.
public int
doAfterBody()
Save the body content of the Anchor.
public int
doEndTag()
Render the hyperlink.
public int
doStartTag()
Prepare the hyperlink for rendering
public String
getAccessKey()
Gets the accessKey attribute value.
public String
getAction()
Return the action of the Anchor.
public boolean
getFormSubmit()
Return the formSubmit indicator.
public String
getForward()
Return the forward name of the Anchor.
public String
getHref()
Return the href of the Anchor.
public String
getId()
Return the ID associated with this tag.
public String
getLinkName()
Return the link name of the Anchor.
public String
getLocation()
Returns the anchor to be added to the end of the generated hyperlink.
public String
getOnBlur()
Gets the onBlur javascript event.
public String
getOnClick()
Gets the onClick javascript event.
public String
getOnDblClick()
Gets the onDblClick javascript event.
public String
getOnFocus()
Gets the onFocus javascript event.
public String
getOnKeyDown()
Gets the onKeyDown javascript event.
public String
getOnKeyPress()
Gets the onKeyPress javascript event.
public String
getOnKeyUp()
Gets the onKeyUp javascript event.
public String
getOnMouseDown()
Gets the onMouseDown javascript event.
public String
getOnMouseMove()
Gets the onMouseMove javascript event.
public String
getOnMouseOut()
Gets the onMouseOut javascript event.
public String
getOnMouseOver()
Gets the onMouseOver javascript event.
public String
getOnMouseUp()
Gets the onMouseUp javascript event.
public String
getPage()
Returns the module-relative page URL to which this hyperlink will be rendered.
protected String
getRealFormName()
This will get the real name of the form.
public String
getStyle()
Gets the style of the rendered html tag.
public String
getStyleClass()
Gets the style class of the rendered html tag.
public String
getTabindex()
Gets the tabIndex of the rendered html tag.
public String
getTagId()
Return the ID of the tag.
public String
getTagName()
Returns the name of the Tag.
public String
getTarget()
Returns the window target.
protected void
localRelease()
Release any acquired resources.
public void
setAccessKey(String accessKey)
Sets the accessKey attribute value.
public void
setAction(String action)
Set the name of the action for the Anchor.
public void
setAttribute(String name, String value)
Set an attribute value.
public void
setFormSubmit(boolean formSubmit)
Sets the formSubmit indicator.
public void
setForward(String forward)
Sets the forward name of the Anchor.
public void
setHref(String href)
Sets the href of the Anchor.
public void
setId(String id)
Set the ID attribute of the tag.
public void
setLinkName(String linkName)
Sets the link name of the Anchor.
public void
setLocation(String location)
Sets the anchor to be added to the end of the generated hyperlink.
public void
setOnBlur(String onblur)
Sets the onBlur javascript event.
public void
setOnClick(String onclick)
Sets the onClick javascript event.
public void
setOnDblClick(String ondblclick)
Sets the onDblClick javascript event.
public void
setOnFocus(String onfocus)
Sets the onFocus javascript event.
public void
setOnKeyDown(String onkeydown)
Sets the onKeyDown javascript event.
public void
setOnKeyPress(String onkeypress)
Sets the onKeyPress javascript event.
public void
setOnKeyUp(String onkeyup)
Sets the onKeyUp javascript event.
public void
setOnMouseDown(String onmousedown)
Sets the onMouseDown javascript event.
public void
setOnMouseMove(String onmousemove)
Sets the onMouseMove javascript event.
public void
setOnMouseOut(String onmouseout)
Sets the onMouseOut javascript event.
public void
setOnMouseOver(String onmouseover)
Sets the onMouseOver javascript event.
public void
setOnMouseUp(String onmouseup)
Sets the onMouseUp javascript event.
public void
setPage(String page)
Sets the module-relative page URL to which this hyperlink will be rendered.
public void
setStyle(String style)
Sets the style of the rendered html tag.
public void
setStyleClass(String styleClass)
Sets the style class of the rendered html tag.
public void
setTabindex(String tabindex)
Sets the tabIndex of the rendered html tag.
public void
setTagId(String tagId)
Set the ID of the tag.
public void
setTarget(String target)
Sets the window target.
 
Methods from  com.bea.wlw.netui.tags.AbstractBaseTag
addTagIdMapping, evaluateAttributeToString, filter, filter, getJavaScriptUtils, getNearestForm, getScriptReporter, getUserLocale, registerTagError, release, renderAttribute, rewriteName, write
 
Methods from  javax.servlet.jsp.tagext.BodyTagSupport
doInitBody, getBodyContent, getPreviousOut, release, setBodyContent
 
Methods from  javax.servlet.jsp.tagext.TagSupport
doAfterBody, doEndTag, doStartTag, findAncestorWithClass, getParent, getValue, getValues, release, removeValue, setPageContext, setParent, setValue
 
Methods from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
   
Methods from interface javax.servlet.jsp.tagext.BodyTag
doInitBody, setBodyContent
 
Methods from interface com.bea.wlw.netui.tags.IAttributeConsumer
setAttribute
 
Methods from interface javax.servlet.jsp.tagext.IterationTag
doAfterBody
 
Methods from interface javax.servlet.jsp.tagext.Tag
doEndTag, doStartTag, getParent, release, setPageContext, setParent
 
Methods from interface com.bea.wlw.netui.tags.html.URLParams
addParameter
 

Field Detail

HREF

public static final String HREF


id

protected String id

 

Constructor Detail

Anchor

public Anchor()
 

Method Detail

addParameter(String, Object) Method

public void addParameter(String name, 
                         Object value)
throws JspException
Adds a URL parameter to the generated hyperlink.

Parameters

name
- the name of the parameter to be added.
value
- the value of the parameter to be added (a String or String[]).

Exceptions

JspException

createAnchorAttributes(UnsyncStringBuffer) Method

protected void createAnchorAttributes(UnsyncStringBuffer results)
Method which will write additional attributes into the anchor being created by the createAnchorBeginTag method. This allows subclasses to override which sets of attributes are attached to the <a> tag.


createAnchorBeginTag(UnsyncStringBuffer, UnsyncStringBuffer, boolean) Method

protected boolean createAnchorBeginTag(UnsyncStringBuffer results, 
                                       UnsyncStringBuffer script, 
                                       boolean encodeAction)
throws JspException
This method will take all of the internal variables and create an anchor.

Exceptions

JspException

doAfterBody() Method

public int doAfterBody()
throws JspException
Save the body content of the Anchor.

Overrides
BodyTagSupport.doAfterBody()

Exceptions

JspException
if a JSP exception has occurred

doEndTag() Method

public int doEndTag()
throws JspException
Render the hyperlink.

Overrides
BodyTagSupport.doEndTag()

Exceptions

JspException
if a JSP exception has occurred

doStartTag() Method

public int doStartTag()
throws JspException
Prepare the hyperlink for rendering

Overrides
BodyTagSupport.doStartTag()

Exceptions

JspException
if a JSP exception has occurred

getAccessKey() Method

public String getAccessKey()
Gets the accessKey attribute value.

Returns

the accessKey value.

getAction() Method

public String getAction()
Return the action of the Anchor.

Returns

a String representing the action name of the Anchor.

getFormSubmit() Method

public boolean getFormSubmit()
Return the formSubmit indicator.

Returns

a String representing whether or not the enclosing Form should be submitted.

getForward() Method

public String getForward()
Return the forward name of the Anchor.

Returns

the Anchor's logical forward name

getHref() Method

public String getHref()
Return the href of the Anchor.

Returns

the hyperlink URI

getId() Method

public String getId()
Return the ID associated with this tag.

Overrides
TagSupport.getId()

Returns

the ID.

getLinkName() Method

public String getLinkName()
Return the link name of the Anchor.

Returns

the linkName

getLocation() Method

public String getLocation()
Returns the anchor to be added to the end of the generated hyperlink.

Returns

the name of the location anchor.

getOnBlur() Method

public String getOnBlur()
Gets the onBlur javascript event.

Returns

the onBlur event.

getOnClick() Method

public String getOnClick()
Gets the onClick javascript event.

Returns

the onClick event.

getOnDblClick() Method

public String getOnDblClick()
Gets the onDblClick javascript event.

Returns

the onDblClick event.

getOnFocus() Method

public String getOnFocus()
Gets the onFocus javascript event.

Returns

the onFocus event.

getOnKeyDown() Method

public String getOnKeyDown()
Gets the onKeyDown javascript event.

Returns

the onKeyDown event.

getOnKeyPress() Method

public String getOnKeyPress()
Gets the onKeyPress javascript event.

Returns

the onKeyPress event.

getOnKeyUp() Method

public String getOnKeyUp()
Gets the onKeyUp javascript event.

Returns

the onKeyUp event.

getOnMouseDown() Method

public String getOnMouseDown()
Gets the onMouseDown javascript event.

Returns

the onMouseDown event.

getOnMouseMove() Method

public String getOnMouseMove()
Gets the onMouseMove javascript event.

Returns

the onMouseMove event.

getOnMouseOut() Method

public String getOnMouseOut()
Gets the onMouseOut javascript event.

Returns

the onMouseOut event.

getOnMouseOver() Method

public String getOnMouseOver()
Gets the onMouseOver javascript event.

Returns

the onMouseOver event.

getOnMouseUp() Method

public String getOnMouseUp()
Gets the onMouseUp javascript event.

Returns

the onMouseUp event.

getPage() Method

public String getPage()
Returns the module-relative page URL to which this hyperlink will be rendered.

Returns

the page URL.

getRealFormName() Method

protected String getRealFormName()
This will get the real name of the form. This is set in the id attribute.

Returns

The String real name of the containing form.

getStyle() Method

public String getStyle()
Gets the style of the rendered html tag.

Returns

the style.

getStyleClass() Method

public String getStyleClass()
Gets the style class of the rendered html tag.

Returns

the style class.

getTabindex() Method

public String getTabindex()
Gets the tabIndex of the rendered html tag.

Returns

the tabindex.

getTagId() Method

public String getTagId()
Return the ID of the tag. The id may be rewritten by the container (such as a portal) to make sure it is unique. JavaScript my lookup the actual id of the element by looking it up in the netui_names table written into the HTML.

Returns

the tagId.

getTagName() Method

public String getTagName()
Returns the name of the Tag.

Overrides
AbstractBaseTag.getTagName()

getTarget() Method

public String getTarget()
Returns the window target.

Returns

the window target.

localRelease() Method

protected void localRelease()
Release any acquired resources.

Overrides
AbstractBaseTag.localRelease()

setAccessKey(String) Method

public void setAccessKey(String accessKey)
Sets the accessKey attribute value. This should key value of the keyboard navigation key. It is recommended not to use the following values because there are often used by browsers A, C, E, F, G, H, V, left arrow, and right arrow.

Parameters

accessKey
- the accessKey value.

setAction(String) Method

public void setAction(String action)
Set the name of the action for the Anchor.

Parameters

action
- the name of the action to set for the Anchor.

setAttribute(String, String) Method

public void setAttribute(String name, 
                         String value)
throws JspException
Set an attribute value. The name represents the name of the attribute. The value represents the value and may contain a netui expression. This method may result in errors being generated. This requires that the tag buffer its body and write attributes in the end tag. For the anchor tag it is not legal to set the id, name, or href attributes with this method.

Parameters

name
The name of the attribute. This value may not be null or the empty string.
value
The value of the attribute. This may contain a netui expression.

Exceptions

JspException
A JspException may be thrown if there is an error setting the attribute.

setFormSubmit(boolean) Method

public void setFormSubmit(boolean formSubmit)
Sets the formSubmit indicator.

Parameters

formSubmit
- whether or not the enclosing Form should be submitted.

setForward(String) Method

public void setForward(String forward)
Sets the forward name of the Anchor.

Parameters

forward
- the logical forward name from which to retrieve the hyperlink URI.

setHref(String) Method

public void setHref(String href)
Sets the href of the Anchor.

Parameters

href
- the hyperlink URI for the Anchor.

setId(String) Method

public void setId(String id)
Set the ID attribute of the tag.

Overrides
TagSupport.setId(String)

Parameters

id
- the ID.

setLinkName(String) Method

public void setLinkName(String linkName)
Sets the link name of the Anchor.

Parameters

linkName
- the link name for the Anchor.

setLocation(String) Method

public void setLocation(String location)
Sets the anchor to be added to the end of the generated hyperlink.

Parameters

location
- the name of the location anchor.

setOnBlur(String) Method

public void setOnBlur(String onblur)
Sets the onBlur javascript event.

Parameters

onblur
- the onBlur event.

setOnClick(String) Method

public void setOnClick(String onclick)
Sets the onClick javascript event.

Parameters

onclick
- the onClick event.

setOnDblClick(String) Method

public void setOnDblClick(String ondblclick)
Sets the onDblClick javascript event.

Parameters

ondblclick
- the onDblClick event.

setOnFocus(String) Method

public void setOnFocus(String onfocus)
Sets the onFocus javascript event.

Parameters

onfocus
- the onFocus event.

setOnKeyDown(String) Method

public void setOnKeyDown(String onkeydown)
Sets the onKeyDown javascript event.

Parameters

onkeydown
- the onKeyDown event.

setOnKeyPress(String) Method

public void setOnKeyPress(String onkeypress)
Sets the onKeyPress javascript event.

Parameters

onkeypress
- the onKeyPress event.

setOnKeyUp(String) Method

public void setOnKeyUp(String onkeyup)
Sets the onKeyUp javascript event.

Parameters

onkeyup
- the onKeyUp event.

setOnMouseDown(String) Method

public void setOnMouseDown(String onmousedown)
Sets the onMouseDown javascript event.

Parameters

onmousedown
- the onMouseDown event.

setOnMouseMove(String) Method

public void setOnMouseMove(String onmousemove)
Sets the onMouseMove javascript event.

Parameters

onmousemove
- the onMouseMove event.

setOnMouseOut(String) Method

public void setOnMouseOut(String onmouseout)
Sets the onMouseOut javascript event.

Parameters

onmouseout
- the onMouseOut event.

setOnMouseOver(String) Method

public void setOnMouseOver(String onmouseover)
Sets the onMouseOver javascript event.

Parameters

onmouseover
- the onMouseOver event.

setOnMouseUp(String) Method

public void setOnMouseUp(String onmouseup)
Sets the onMouseUp javascript event.

Parameters

onmouseup
- the onMouseUp event.

setPage(String) Method

public void setPage(String page)
Sets the module-relative page URL to which this hyperlink will be rendered.

Parameters

page
- the page URL.

setStyle(String) Method

public void setStyle(String style)
Sets the style of the rendered html tag.

Parameters

style
- the html style.

setStyleClass(String) Method

public void setStyleClass(String styleClass)
Sets the style class of the rendered html tag.

Parameters

styleClass
- the html style class.

setTabindex(String) Method

public void setTabindex(String tabindex)
Sets the tabIndex of the rendered html tag.

Parameters

tabindex
- the tab index.

setTagId(String) Method

public void setTagId(String tagId)
Set the ID of the tag.

Parameters

tagId
- the tagId.

setTarget(String) Method

public void setTarget(String target)
Sets the window target.

Parameters

target
- the window target.