BEA NetUI tags and APIs are included for backward compatibility only. For new applications, use the Beehive tags and APIs.

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

java.lang.Object
  extended by javax.servlet.jsp.tagext.TagSupport
      extended by javax.servlet.jsp.tagext.BodyTagSupport
          extended by com.bea.wlw.netui.tags.AbstractBaseTag
              extended by com.bea.wlw.netui.tags.html.Anchor
                  extended by com.bea.wlw.netui.tags.html.ImageAnchor
All Implemented Interfaces:
HtmlConstants, URLParams, IAttributeConsumer, Serializable, javax.servlet.jsp.tagext.BodyTag, javax.servlet.jsp.tagext.IterationTag, javax.servlet.jsp.tagext.JspTag, javax.servlet.jsp.tagext.Tag

public class ImageAnchor
extends Anchor

Generates a hyperlink with a clickable image. ImageAnchor provides support for image rollovers. An imageAnchor 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.
alignNoNoNo
Property to specify where to align the image.
altNoNoRead Only
Property to specify alt text of an image.
borderNoNoRead Only
The border size around the image
formSubmitNoNoNo
True if clicking this link should submit its enclosing form.
forwardNoNoNo
The logical forward name from which to retrieve the hyperlink URI.
heightNoNoRead Only
The image height
hrefNoNoRead Only
A URL to go to.
hspaceNoNoRead Only
The horizontal spacing around the image
idNoNoNo
The id attribute has been deprecated; instead, use tagId. The id attribute of the generated ImageAnchor. You should use the tagId which will encode the id correctly for containers such as the Portal which needs to rewrite IDs to make them unique.
isMapNoNoNo
The server-side image map declaration.
linkNameNoNoNo
An internal place in the page to move to.
locationNoNoNo
Location within the URI to visit.
lowsrcNoNoNo
The low resolution image source URI.
pageNoNoNo
The page attribute has been deprecated. The module-relative page URL to which this hyperlink will be rendered.
rolloverImageNoNoNo
The URI of the rollover image.
srcNoNoRead Only
The image source URI
targetNoNoNo
The window target.
tagIdNoNoNo
The id of this imageAnchor. 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( tagId, tag ) method written by the <netui:html> tag.
useMapNoNoNo
The client-side image map declaration.
vspaceNoNoRead Only
The vertical spacing around the image.
widthNoNoRead Only
The image width.

See Also:
Serialized Form
Example:
In this sample, an <netui:imageAnchor> shows "top.jpg" at 25 x 25 pixels and navigates to index.jsp when clicked.
    <netui:imageAnchor href="index.jsp" src="top.jpg" height="25" width="25" />

Code Sample

[BEA_HOME]/weblogic81/samples/workshop/SamplesApp/WebApp/tagSamples/netui/imageAnchor/
Beadoc.see:
<netui:imageAnchor> Tag Sample
Beadoc.tagdescription:

Generates a hyperlink with a clickable image. Provides support for image rollovers.

The <netui:imageAnchor> tag must have one of five attributes to correctly create the hyperlink:

  • action - an action method invoked by clicking the hyperlink
  • forward - a forward to redirect to
  • href - an URL to go to
  • linkName - an internal place in the page to move to
  • page - the module-relative page URL to which this hyperlink will be rendered

JavaScript

If an <netui:imageAnchor> sets the formSubmit attribute to true and no onClick attribute is set, the following JavaScript function will be written into the page. The JavaScript function will be referenced by the onclick attribute of the generated image anchor, and will cause the parent form to submit:

    function submit[formname][formAction]Form() {
      for(var i=0; i<document.forms.length; i++) {
        if (document.forms[i].id == "[formAction]") {
          document.forms[i].method = "POST";
          document.forms[i].action = "[formAction]";
          document.forms[i].submit();
        }
      }
    }
 

It is possible to write a custom onClick JavaScript event handler that would do additional work, for example form validation, and still submit the form correctly. To accomplish this, reference a JavaScript function in the onClick attribute:

    <netui:imageAnchor formSubmit="true" onClick="SubmitFromAnchor();return false;">
        View Results
    </netui:imageAnchor>

And add the referenced JavaScript function to the page:

    function SubmitFromAnchor()
    {
        // implement custom logic here

        for(var i=0; i<document.forms.length; i++)
        {
            // submit to the action /aWebapp/formPost.do
            if (document.forms[i].action == "/aWebapp/formPost.do")
            {
                document.forms[i].method="POST";
                document.forms[i].action="/aWebapp/formPost.do";
                document.forms[i].submit();
            }
        }
    }

This will cause the JavaScript function to be executed before posting the form.


Field Summary
protected  String src
           
 
Fields inherited from class com.bea.wlw.netui.tags.html.Anchor
_state, HREF, id
 
Fields inherited from class com.bea.wlw.netui.tags.AbstractBaseTag
ATTR_GENERAL, ATTR_GENERAL_EXPRESSION, ATTR_JAVASCRIPT, ATTR_STYLE, JAVASCRIPT_STATUS, NETUI_UNIQUE_CNT
 
Fields inherited from class javax.servlet.jsp.tagext.BodyTagSupport
bodyContent
 
Fields inherited from class javax.servlet.jsp.tagext.TagSupport
pageContext
 
Fields inherited from interface com.bea.wlw.netui.tags.html.HtmlConstants
ACCEPT, ACCESSKEY, ACTION, ALIGN, ALINK, ALT, ANCHOR, BACKGROUND, BASE, BGCOLOR, BODY, BORDER, BR, CAPTION, CELLPADDING, CELLSPACING, CHAR, CHAROFF, CHARSET, CHECKED, CLASS, COLS, COORDS, DIR, DISABLED, DIV, ENCTYPE, FOR, FORM, FORM_GET, FORM_POST, FRAME, HEIGHT, HREFLANG, HSPACE, HTML, ID, IMAGE, INPUT, INPUT_BUTTON, INPUT_CHECKBOX, INPUT_FILE, INPUT_HIDDEN, INPUT_IMAGE, INPUT_PASSWORD, INPUT_RADIO, INPUT_RESET, INPUT_SUBMIT, INPUT_TEXT, ISMAP, LABEL, LANG, LINK, LONGDESC, MAXLENGTH, METHOD, NAME, ONBLUR, ONCHANGE, ONCLICK, ONDBLCLICK, ONFOCUS, ONKEYDOWN, ONKEYPRESS, ONKEYUP, ONLOAD, ONMOUSEDOWN, ONMOUSEMOVE, ONMOUSEOUT, ONMOUSEOVER, ONMOUSEUP, ONRESET, ONSELECT, ONSUBMIT, ONUNLOAD, OPTION, READONLY, REL, REV, ROWS, RULES, SELECT, SHAPE, SIZE, SPAN, SRC, STYLE, SUMMARY, TABINDEX, TABLE, TARGET, TD, TEXT, TEXTAREA, TITLE, TR, TYPE, USEMAP, VALIGN, VALUE, VLINK, VSPACE, WIDTH
 
Fields inherited from interface javax.servlet.jsp.tagext.BodyTag
EVAL_BODY_BUFFERED, EVAL_BODY_TAG
 
Fields inherited from interface javax.servlet.jsp.tagext.IterationTag
EVAL_BODY_AGAIN
 
Fields inherited from interface javax.servlet.jsp.tagext.Tag
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE
 
Constructor Summary
ImageAnchor()
           
 
Method Summary
 int doEndTag()
          Render the image and hyperlink.
 int doStartTag()
          Insert rollover javascript.
 String getAccessKey()
          Gets the accessKey attribute value.
 String getAlign()
          Gets the property to specify where to align the image.
 String getAlt()
          Gets the property to specify alt text of the image.
 String getBorder()
          Gets the border size around the image.
 String getHeight()
          Gets the image height.
 String getHspace()
          Gets the horizontal spacing around the image.
 String getIsmap()
          Gets the server-side image map declaration.
 String getLowsrc()
          Gets the low resolution image source URI.
 String getPage()
          Gets the module-relative path, starting with a slash character, of the image to be displayed by this rendered tag.
 String getRolloverImage()
          Gets the roll-over image of the ImageAnchor.
 String getSrc()
          Gets the image source URI.
 String getTagName()
          Return the name of the Tag.
 String getUsemap()
          Gets the client-side image map declaration.
 String getVspace()
          Gets the vertical spacing around the image.
 String getWidth()
          Gets the image width.
protected  void localRelease()
          Release any acquired resources.
 void setAccessKey(String accessKey)
          Sets the accessKey attribute value.
 void setAlign(String align)
          Sets the property to specify where to align the image.
 void setAlt(String alt)
          Sets the property to specify the alt text of the image.
 void setAttribute(String name, String value)
          Set an attribute value.
 void setBorder(String border)
          Sets the border size around the image.
 void setHeight(String height)
          Sets the image height.
 void setHspace(String hspace)
          Sets the the horizontal spacing around the image.
 void setIsmap(String ismap)
          Sets the server-side image map declaration.
 void setLowsrc(String lowsrc)
          Sets the the low resolution image source URI.
 void setPage(String page)
          Sets the module-relative path, starting with a slash character, of the image to be displayed by this rendered tag.
 void setRolloverImage(String rolloverImage)
          Sets the roll-over image of the ImageAnchor.
 void setSrc(String src)
          Sets the image source URI.
 void setUsemap(String usemap)
          Sets the client-side image map declaration.
 void setVspace(String vspace)
          Sets the vertical spacing around the image.
 void setWidth(String width)
          Sets the image width.
protected  String src()
          Return the base source URL that will be rendered in the src property for this generated element, or null if there is no such URL.
protected  String url(String url)
          Return the specified src URL, modified as necessary with optional request parameters.
 
Methods inherited from class com.bea.wlw.netui.tags.html.Anchor
addParameter, calculateURL, createAnchorBeginTag, doAfterBody, getAction, getFormAction, getFormActionURL, getFormSubmit, getForward, getHref, getId, getLinkName, getLocation, getOnBlur, getOnClick, getOnDblClick, getOnFocus, getOnKeyDown, getOnKeyPress, getOnKeyUp, getOnMouseDown, getOnMouseMove, getOnMouseOut, getOnMouseOver, getOnMouseUp, getRealFormName, getStyle, getStyleClass, getTabindex, getTagId, getTarget, setAction, setFormSubmit, setForward, setHref, setId, setLinkName, setLocation, setOnBlur, setOnClick, setOnDblClick, setOnFocus, setOnKeyDown, setOnKeyPress, setOnKeyUp, setOnMouseDown, setOnMouseMove, setOnMouseOut, setOnMouseOver, setOnMouseUp, setStyle, setStyleClass, setTabindex, setTagId, setTarget, stripSlashes
 
Methods inherited from class com.bea.wlw.netui.tags.AbstractBaseTag
addTagIdMapping, containsExpression, evaluateAttributeToString, evaluateExpression, filter, filter, formatErrorString, formatString, getAttribute, getErrorsReport, getExpressionEvaluator, getJavaScriptUtils, getNearestForm, getNextId, getQualifiedBundleName, getScriptReporter, getUserLocale, hasErrors, isExpression, prepForRendering, registerAttribute, registerError, registerTagError, release, removeAttribute, renderAttribute, renderAttributes, reportErrors, rewriteName, setPageContext, updateExpression, write
 
Methods inherited from class javax.servlet.jsp.tagext.BodyTagSupport
doInitBody, getBodyContent, getPreviousOut, setBodyContent
 
Methods inherited from class javax.servlet.jsp.tagext.TagSupport
findAncestorWithClass, getParent, getValue, getValues, removeValue, setParent, setValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.servlet.jsp.tagext.Tag
getParent, setParent
 

Field Detail

src

protected String src
Constructor Detail

ImageAnchor

public ImageAnchor()
Method Detail

getTagName

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

Overrides:
getTagName in class Anchor

setAttribute

public void setAttribute(String name,
                         String value)
                  throws javax.servlet.jsp.JspException
Description copied from class: Anchor
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.

Specified by:
setAttribute in interface IAttributeConsumer
Overrides:
setAttribute in class Anchor
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.
Throws:
javax.servlet.jsp.JspException - A JspException may be thrown if there is an error setting the attribute.

getAlign

public String getAlign()
Gets the property to specify where to align the image.

Returns:
the image alignment.

setAlign

public void setAlign(String align)
Sets the property to specify where to align the image.

Parameters:
align - - the image alignment.
Beadoc.attributedescription:
The alignment of the image.
Beadoc.attributesyntaxvalue:
string_align
Beadoc.databindable:
false

getAlt

public String getAlt()
Gets the property to specify alt text of the image.

Returns:
the alt string.

setAlt

public void setAlt(String alt)
Sets the property to specify the alt text of the image.

Parameters:
alt - - the image alignment.
Beadoc.attributedescription:
The alternative text of the image
Beadoc.attributesyntaxvalue:
string_alt
Beadoc.databindable:
Read Only

getAccessKey

public String getAccessKey()
Gets the accessKey attribute value.

Overrides:
getAccessKey in class Anchor
Returns:
the accessKey value.

setAccessKey

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.

Overrides:
setAccessKey in class Anchor
Parameters:
accessKey - - the accessKey value.
Beadoc.attributedescription:
The keyboard navigation key for the element. The following values are not recommended because they are often used by browsers: A, C, E, F, G, H, V, left arrow, and right arrow
Beadoc.attributesyntaxvalue:
string_accessKey
Beadoc.databindable:
false

getBorder

public String getBorder()
Gets the border size around the image.

Returns:
the border size.

setBorder

public void setBorder(String border)
Sets the border size around the image.

Parameters:
border - - the border size.
Beadoc.attributedescription:
The border size around the image
Beadoc.attributesyntaxvalue:
integer_pixelBorder
Beadoc.databindable:
false

getHeight

public String getHeight()
Gets the image height.

Returns:
the height.

setHeight

public void setHeight(String height)
Sets the image height.

Parameters:
height - - the height.
Beadoc.attributedescription:
The image height
Beadoc.attributesyntaxvalue:
integer_height
Beadoc.databindable:
Read Only

getHspace

public String getHspace()
Gets the horizontal spacing around the image.

Returns:
the horizontal spacing.

setHspace

public void setHspace(String hspace)
Sets the the horizontal spacing around the image.

Parameters:
hspace - - the horizontal spacing.
Beadoc.attributedescription:
The horizontal spacing around the image.
Beadoc.attributesyntaxvalue:
integer_hspace
Beadoc.databindable:
Read Only

getIsmap

public String getIsmap()
Gets the server-side image map declaration.

Returns:
the image map declaration.

setIsmap

public void setIsmap(String ismap)
Sets the server-side image map declaration.

Parameters:
ismap - - the image map declaration.
Beadoc.attributedescription:
The server-side map declaration.
Beadoc.attributesyntaxvalue:
string_isMap
Beadoc.databindable:
false

getLowsrc

public String getLowsrc()
Gets the low resolution image source URI.

Returns:
the low-res image source URI.

setLowsrc

public void setLowsrc(String lowsrc)
Sets the the low resolution image source URI.

Parameters:
lowsrc - - the low-res image source URI.
Beadoc.attributedescription:
The low resolution image source URI
Beadoc.attributesyntaxvalue:
string_lowsrc
Beadoc.databindable:
false

getPage

public String getPage()
Gets the module-relative path, starting with a slash character, of the image to be displayed by this rendered tag.

Overrides:
getPage in class Anchor
Returns:
the module-relative path.

setPage

public void setPage(String page)
Sets the module-relative path, starting with a slash character, of the image to be displayed by this rendered tag.

Overrides:
setPage in class Anchor
Parameters:
page - - the module-relative path.
Beadoc.attributedescription:
The page attribute has been deprecated. The module-relative path of the image to be displayed by this rendered tag.
Beadoc.attributesyntaxvalue:
string_page
Beadoc.databindable:
false

getRolloverImage

public String getRolloverImage()
Gets the roll-over image of the ImageAnchor.

Returns:
the rollover image.

setRolloverImage

public void setRolloverImage(String rolloverImage)
Sets the roll-over image of the ImageAnchor.

Parameters:
rolloverImage - - the rollover image.
Beadoc.attributedescription:
The URI of the rollover image.
Beadoc.attributesyntaxvalue:
string_rolloverImage
Beadoc.databindable:
false

getSrc

public String getSrc()
Gets the image source URI.

Returns:
the image source URI.

setSrc

public void setSrc(String src)
Sets the image source URI.

Parameters:
src - - the image source URI.
Beadoc.attributedescription:
The image source URI
Beadoc.attributesyntaxvalue:
string_src
Beadoc.databindable:
Read Only

getUsemap

public String getUsemap()
Gets the client-side image map declaration.

Returns:
the map declaration.

setUsemap

public void setUsemap(String usemap)
Sets the client-side image map declaration.

Parameters:
usemap - - the map declaration.
Beadoc.attributedescription:
The client-side image map declaration
Beadoc.attributesyntaxvalue:
string_useMap
Beadoc.databindable:
false

getVspace

public String getVspace()
Gets the vertical spacing around the image.

Returns:
the vertical spacing.

setVspace

public void setVspace(String vspace)
Sets the vertical spacing around the image.

Parameters:
vspace - - the vertical spacing.
Beadoc.attributedescription:
The vertical spacing around the image.
Beadoc.attributesyntaxvalue:
string_vspace
Beadoc.databindable:
Read Only

getWidth

public String getWidth()
Gets the image width.

Returns:
the image width.

setWidth

public void setWidth(String width)
Sets the image width.

Parameters:
width - - the image width.
Beadoc.attributedescription:
The image width.
Beadoc.attributesyntaxvalue:
integer_pixelWidth
Beadoc.databindable:
Read Only

doStartTag

public int doStartTag()
               throws javax.servlet.jsp.JspException
Insert rollover javascript.

Support for indexed property since Struts 1.1

Specified by:
doStartTag in interface javax.servlet.jsp.tagext.Tag
Overrides:
doStartTag in class Anchor
Throws:
javax.servlet.jsp.JspException - if a JSP exception has occurred

doEndTag

public int doEndTag()
             throws javax.servlet.jsp.JspException
Render the image and hyperlink.

Specified by:
doEndTag in interface javax.servlet.jsp.tagext.Tag
Overrides:
doEndTag in class Anchor
Throws:
javax.servlet.jsp.JspException - if a JSP exception has occurred

localRelease

protected void localRelease()
Release any acquired resources.

Overrides:
localRelease in class Anchor

src

protected String src()
              throws javax.servlet.jsp.JspException
Return the base source URL that will be rendered in the src property for this generated element, or null if there is no such URL.

Throws:
javax.servlet.jsp.JspException - if an error occurs
Exclude:

url

protected String url(String url)
              throws javax.servlet.jsp.JspException
Return the specified src URL, modified as necessary with optional request parameters.

Parameters:
url - The URL to be modified (or null if this url will not be used)
Throws:
javax.servlet.jsp.JspException - if an error occurs preparing the URL
Exclude:

BEA NetUI tags and APIs are included for backward compatibility only. For new applications, use the Beehive tags and APIs.