Apache Struts API Documentation: Class ImgTag

Apache Struts API


org.apache.struts.taglib.html Class ImgTag

java.lang.Object
  |
  +--javax.servlet.jsp.tagext.TagSupport
        |
        +--javax.servlet.jsp.tagext.BodyTagSupport
              |
              +--org.apache.struts.taglib.html.BaseHandlerTag
                    |
                    +--org.apache.struts.taglib.html.ImgTag
All Implemented Interfaces:
javax.servlet.jsp.tagext.BodyTag, java.io.Serializable, javax.servlet.jsp.tagext.Tag
Direct Known Subclasses:
NestedImgTag

public class ImgTag
extends BaseHandlerTag

Generate an IMG tag to the specified image URI.

TODO:

  • Make the alt, src, and lowsrc settable from properties (for i18n)

Version:
$Rev: 164927 $
See Also:
Serialized Form

Field Summary
protected  java.lang.String action
          The module-relative action (beginning with a slash) which will be used as the source for this image.
protected  java.lang.String align
          The property to specify where to align the image.
protected  java.lang.String border
          The border size around the image.
protected  java.lang.String contextRelative
          Deprecated. Use module property instead; will be removed in a release after 1.2.0.
protected  java.lang.String height
          The image height.
protected  java.lang.String hspace
          The horizontal spacing around the image.
protected  java.lang.String imageName
          The image name for named images.
protected  java.lang.String ismap
          Server-side image map declaration.
protected  java.lang.String lowsrc
          Deprecated. This is not defined in the HTML 4.01 spec and will be removed in a future version of Struts.
protected static MessageResources messages
          The message resources for this package.
protected  java.lang.String module
          The module prefix (beginning with a slash) which will be used to find the action for this link.
protected  java.lang.String name
          The JSP bean name for query parameters.
protected  java.lang.String page
          The module-relative path, starting with a slash character, of the image to be displayed by this rendered tag.
protected  java.lang.String pageKey
          The message resources key under which we should look up the page attribute for this generated tag, if any.
protected  java.lang.String paramId
          In situations where an image is dynamically generated (such as to create a chart graph), this specifies the single-parameter request parameter name to generate.
protected  java.lang.String paramName
          The single-parameter JSP bean name.
protected  java.lang.String paramProperty
          The single-parameter JSP bean property.
protected  java.lang.String paramScope
          The single-parameter JSP bean scope.
protected  java.lang.String property
          The JSP bean property name for query parameters.
protected  java.lang.String scope
          The scope of the bean specified by the name property, if any.
protected  java.lang.String src
          The image source URI.
protected  java.lang.String srcKey
          The message resources key under which we should look up the src attribute for this generated tag, if any.
protected  boolean useLocalEncoding
           
protected  java.lang.String usemap
          Client-side image map declaration.
protected  java.lang.String vspace
          The vertical spacing around the image.
protected  java.lang.String width
          The image width.
 
Fields inherited from class org.apache.struts.taglib.html.BaseHandlerTag
accesskey, alt, altKey, bundle, defaultLocale, disabled, doDisabled, doReadonly, errorKey, errorStyle, errorStyleClass, errorStyleId, indexed, locale, log, loopTagStatusClass, loopTagStatusGetIndex, loopTagSupportClass, loopTagSupportGetStatus, onblur, onchange, onclick, ondblclick, onfocus, onkeydown, onkeypress, onkeyup, onmousedown, onmousemove, onmouseout, onmouseover, onmouseup, onselect, readonly, style, styleClass, styleId, tabindex, title, titleKey, triedJstlInit, triedJstlSuccess
 
Fields inherited from class javax.servlet.jsp.tagext.BodyTagSupport
bodyContent
 
Fields inherited from class javax.servlet.jsp.tagext.TagSupport
id, pageContext, parent, values
 
Fields inherited from interface javax.servlet.jsp.tagext.BodyTag
EVAL_BODY_TAG
 
Fields inherited from interface javax.servlet.jsp.tagext.Tag
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE
 
Constructor Summary
ImgTag()
           
 
Method Summary
 int doEndTag()
          Render the end of the IMG tag.
 int doStartTag()
          Render the beginning of the IMG tag.
 java.lang.String getAction()
           
 java.lang.String getAlign()
           
 java.lang.String getBorder()
           
 java.lang.String getContextRelative()
          Deprecated. Use module property instead; will be removed in a release after 1.2.0.
 java.lang.String getHeight()
           
 java.lang.String getHspace()
           
 java.lang.String getImageName()
           
 java.lang.String getIsmap()
           
 java.lang.String getLowsrc()
          Deprecated. This is not defined in the HTML 4.01 spec and will be removed in a future version of Struts.
 java.lang.String getModule()
           
 java.lang.String getName()
           
 java.lang.String getPage()
           
 java.lang.String getPageKey()
           
 java.lang.String getParamId()
           
 java.lang.String getParamName()
           
 java.lang.String getParamProperty()
           
 java.lang.String getParamScope()
           
 java.lang.String getProperty()
           
 java.lang.String getScope()
           
 java.lang.String getSrc()
           
 java.lang.String getSrcKey()
           
 java.lang.String getUsemap()
           
 java.lang.String getVspace()
           
 java.lang.String getWidth()
           
 boolean isContextRelativeSet()
          Deprecated. Use module property instead; will be removed in a release after 1.2.0.
 boolean isUseLocalEncoding()
           
 void release()
          Release any acquired resources.
 void setAction(java.lang.String action)
           
 void setAlign(java.lang.String align)
           
 void setBorder(java.lang.String border)
           
 void setContextRelative(java.lang.String contextRelative)
          Deprecated. Use module property instead; will be removed in a release after 1.2.0.
 void setHeight(java.lang.String height)
           
 void setHspace(java.lang.String hspace)
           
 void setImageName(java.lang.String imageName)
           
 void setIsmap(java.lang.String ismap)
           
 void setLowsrc(java.lang.String lowsrc)
           
 void setModule(java.lang.String module)
           
 void setName(java.lang.String name)
           
 void setPage(java.lang.String page)
           
 void setPageKey(java.lang.String pageKey)
           
 void setParamId(java.lang.String paramId)
           
 void setParamName(java.lang.String paramName)
           
 void setParamProperty(java.lang.String paramProperty)
           
 void setParamScope(java.lang.String paramScope)
           
 void setProperty(java.lang.String property)
           
 void setScope(java.lang.String scope)
           
 void setSrc(java.lang.String src)
           
 void setSrcKey(java.lang.String srcKey)
           
 void setUseLocalEncoding(boolean b)
           
 void setUsemap(java.lang.String usemap)
           
 void setVspace(java.lang.String vspace)
           
 void setWidth(java.lang.String width)
           
protected  java.lang.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.
private  boolean srcDefaultReference(ModuleConfig config)
          Convenience method to test whether this is the default module or if contestRelative has been set.
private  void throwImgTagSrcException()
          Convenience method to throw a "imgTag.src" exception.
protected  java.lang.String url(java.lang.String url)
          Return the specified src URL, modified as necessary with optional request parameters.
 
Methods inherited from class org.apache.struts.taglib.html.BaseHandlerTag
doErrorsExist, getAccesskey, getAlt, getAltKey, getBundle, getDisabled, getElementClose, getErrorKey, getErrorStyle, getErrorStyleClass, getErrorStyleId, getIndexed, getIndexValue, getJstlLoopIndex, getLocale, getOnblur, getOnchange, getOnclick, getOndblclick, getOnfocus, getOnkeydown, getOnkeypress, getOnkeyup, getOnmousedown, getOnmousemove, getOnmouseout, getOnmouseover, getOnmouseup, getOnselect, getReadonly, getStyle, getStyleClass, getStyleId, getTabindex, getTitle, getTitleKey, isXhtml, lookupProperty, message, prepareAttribute, prepareEventHandlers, prepareFocusEvents, prepareIndex, prepareKeyEvents, prepareMouseEvents, prepareName, prepareOtherAttributes, prepareStyles, prepareTextEvents, setAccesskey, setAlt, setAltKey, setBundle, setDisabled, setErrorKey, setErrorStyle, setErrorStyleClass, setErrorStyleId, setIndexed, setLocale, setOnblur, setOnchange, setOnclick, setOndblclick, setOnfocus, setOnkeydown, setOnkeypress, setOnkeyup, setOnmousedown, setOnmousemove, setOnmouseout, setOnmouseover, setOnmouseup, setOnselect, setReadonly, setStyle, setStyleClass, setStyleId, setTabindex, setTitle, setTitleKey
 
Methods inherited from class javax.servlet.jsp.tagext.BodyTagSupport
doAfterBody, doInitBody, getBodyContent, getPreviousOut, setBodyContent
 
Methods inherited from class javax.servlet.jsp.tagext.TagSupport
findAncestorWithClass, getId, getParent, getValue, getValues, removeValue, setId, setPageContext, setParent, setValue
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 
Methods inherited from interface javax.servlet.jsp.tagext.Tag
getParent, setPageContext, setParent
 

Field Detail

align

protected java.lang.String align
The property to specify where to align the image.

border

protected java.lang.String border
The border size around the image.

contextRelative

protected java.lang.String contextRelative
Deprecated. Use module property instead; will be removed in a release after 1.2.0.

The property to specify how to root the image. If 'true' or if there is no current module the image is rooted to the application context path If 'false' or absent the image is rooted to the current module's context path.

height

protected java.lang.String height
The image height.

hspace

protected java.lang.String hspace
The horizontal spacing around the image.

imageName

protected java.lang.String imageName
The image name for named images.

ismap

protected java.lang.String ismap
Server-side image map declaration.

lowsrc

protected java.lang.String lowsrc
Deprecated. This is not defined in the HTML 4.01 spec and will be removed in a future version of Struts.

The low resolution image source URI.

messages

protected static MessageResources messages
The message resources for this package.

name

protected java.lang.String name
The JSP bean name for query parameters.

page

protected java.lang.String page
The module-relative path, starting with a slash character, of the image to be displayed by this rendered tag.

pageKey

protected java.lang.String pageKey
The message resources key under which we should look up the page attribute for this generated tag, if any.

action

protected java.lang.String action
The module-relative action (beginning with a slash) which will be used as the source for this image.

module

protected java.lang.String module
The module prefix (beginning with a slash) which will be used to find the action for this link.

paramId

protected java.lang.String paramId
In situations where an image is dynamically generated (such as to create a chart graph), this specifies the single-parameter request parameter name to generate.

paramName

protected java.lang.String paramName
The single-parameter JSP bean name.

paramProperty

protected java.lang.String paramProperty
The single-parameter JSP bean property.

paramScope

protected java.lang.String paramScope
The single-parameter JSP bean scope.

property

protected java.lang.String property
The JSP bean property name for query parameters.

scope

protected java.lang.String scope
The scope of the bean specified by the name property, if any.

src

protected java.lang.String src
The image source URI.

srcKey

protected java.lang.String srcKey
The message resources key under which we should look up the src attribute for this generated tag, if any.

usemap

protected java.lang.String usemap
Client-side image map declaration.

vspace

protected java.lang.String vspace
The vertical spacing around the image.

width

protected java.lang.String width
The image width.

useLocalEncoding

protected boolean useLocalEncoding
Constructor Detail

ImgTag

public ImgTag()
Method Detail

getAlign

public java.lang.String getAlign()

setAlign

public void setAlign(java.lang.String align)

getBorder

public java.lang.String getBorder()

setBorder

public void setBorder(java.lang.String border)

getContextRelative

public java.lang.String getContextRelative()
Deprecated. Use module property instead; will be removed in a release after 1.2.0.


setContextRelative

public void setContextRelative(java.lang.String contextRelative)
Deprecated. Use module property instead; will be removed in a release after 1.2.0.


isContextRelativeSet

public boolean isContextRelativeSet()
Deprecated. Use module property instead; will be removed in a release after 1.2.0.

Convenience method to return true if contextRelative set to "true".
Returns:
True if contextRelative set to "true"

getHeight

public java.lang.String getHeight()

setHeight

public void setHeight(java.lang.String height)

getHspace

public java.lang.String getHspace()

setHspace

public void setHspace(java.lang.String hspace)

getImageName

public java.lang.String getImageName()

setImageName

public void setImageName(java.lang.String imageName)

getIsmap

public java.lang.String getIsmap()

setIsmap

public void setIsmap(java.lang.String ismap)

getLowsrc

public java.lang.String getLowsrc()
Deprecated. This is not defined in the HTML 4.01 spec and will be removed in a future version of Struts.


setLowsrc

public void setLowsrc(java.lang.String lowsrc)

getName

public java.lang.String getName()

setName

public void setName(java.lang.String name)

getPage

public java.lang.String getPage()

setPage

public void setPage(java.lang.String page)

getPageKey

public java.lang.String getPageKey()

setPageKey

public void setPageKey(java.lang.String pageKey)

getAction

public java.lang.String getAction()

setAction

public void setAction(java.lang.String action)

getModule

public java.lang.String getModule()

setModule

public void setModule(java.lang.String module)

getParamId

public java.lang.String getParamId()

setParamId

public void setParamId(java.lang.String paramId)

getParamName

public java.lang.String getParamName()

setParamName

public void setParamName(java.lang.String paramName)

getParamProperty

public java.lang.String getParamProperty()

setParamProperty

public void setParamProperty(java.lang.String paramProperty)

getParamScope

public java.lang.String getParamScope()

setParamScope

public void setParamScope(java.lang.String paramScope)

getProperty

public java.lang.String getProperty()

setProperty

public void setProperty(java.lang.String property)

getScope

public java.lang.String getScope()

setScope

public void setScope(java.lang.String scope)

getSrc

public java.lang.String getSrc()

setSrc

public void setSrc(java.lang.String src)

getSrcKey

public java.lang.String getSrcKey()

setSrcKey

public void setSrcKey(java.lang.String srcKey)

getUsemap

public java.lang.String getUsemap()

setUsemap

public void setUsemap(java.lang.String usemap)

getVspace

public java.lang.String getVspace()

setVspace

public void setVspace(java.lang.String vspace)

getWidth

public java.lang.String getWidth()

setWidth

public void setWidth(java.lang.String width)

isUseLocalEncoding

public boolean isUseLocalEncoding()

setUseLocalEncoding

public void setUseLocalEncoding(boolean b)

doStartTag

public int doStartTag()
               throws javax.servlet.jsp.JspException
Render the beginning of the IMG tag.
Overrides:
doStartTag in class javax.servlet.jsp.tagext.BodyTagSupport
Throws:
javax.servlet.jsp.JspException - if a JSP exception has occurred

doEndTag

public int doEndTag()
             throws javax.servlet.jsp.JspException
Render the end of the IMG tag.
Overrides:
doEndTag in class javax.servlet.jsp.tagext.BodyTagSupport
Throws:
javax.servlet.jsp.JspException - if a JSP exception has occurred

release

public void release()
Release any acquired resources.
Overrides:
release in class BaseHandlerTag

throwImgTagSrcException

private void throwImgTagSrcException()
                              throws javax.servlet.jsp.JspException
Convenience method to throw a "imgTag.src" exception.
Throws:
javax.servlet.jsp.JspException -  

srcDefaultReference

private boolean srcDefaultReference(ModuleConfig config)
Convenience method to test whether this is the default module or if contestRelative has been set.
Parameters:
config - Our Moduleconfig
Returns:
True if this is the default module or contextRelative is set

src

protected java.lang.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

url

protected java.lang.String url(java.lang.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


Copyright � 2000-2005 - The Apache Software Foundation