org.apache.struts.taglib.html

Class BaseHandlerTag

public abstract class BaseHandlerTag extends BodyTagSupport

Base class for tags that render form elements capable of including JavaScript event handlers and/or CSS Style attributes. This class does not implement the doStartTag() or doEndTag() methods. Subclasses should provide appropriate implementations of these.

Version: $Rev: 168243 $ $Date: 2005-05-05 03:35:30 +0100 (Thu, 05 May 2005) $

Field Summary
protected Stringaccesskey
Access key character.
Stringalt
The alternate text of this element.
StringaltKey
The message resources key of the alternate text.
Stringbundle
The name of the message resources bundle for message lookups.
protected static LocaledefaultLocale
The default Locale for our server.
booleandisabled
Component is disabled.
protected booleandoDisabled
Indicates whether 'disabled' is a valid attribute
protected booleandoReadonly

Indicates whether 'readonly' is a valid attribute.

According to the HTML 4.0 Specification <readonly> is valid for <input type="text">, <input type="password"> and <textarea"> elements.

StringerrorKey
The request attribute key for our error messages (if any).
StringerrorStyle
Style attribute associated with component when errors exist.
StringerrorStyleClass
Named Style class associated with component when errors exist.
StringerrorStyleId
Identifier associated with component when errors exist.
protected booleanindexed
Whether to created indexed names for fields
Stringlocale
The name of the session attribute key for our locale.
static Loglog
Commons Logging instance.
ClassloopTagStatusClass
MethodloopTagStatusGetIndex
ClassloopTagSupportClass
MethodloopTagSupportGetStatus
protected static MessageResourcesmessages
The message resources for this package.
Stringonblur
Component lost focus event.
Stringonchange
Content changed after component lost focus event.
Stringonclick
Mouse click event.
Stringondblclick
Mouse double click event.
Stringonfocus
Component has received focus event.
Stringonkeydown
Key down in component event.
Stringonkeypress
Key down and up together in component event.
Stringonkeyup
Key released in component event.
Stringonmousedown
Mouse pressed on component event.
Stringonmousemove
Mouse moved over component event.
Stringonmouseout
Mouse exit component event.
Stringonmouseover
Mouse over component event.
Stringonmouseup
Mouse released on component event.
Stringonselect
Text selected in component event.
booleanreadonly
Component is readonly.
Stringstyle
Style attribute associated with component.
StringstyleClass
Named Style class associated with component.
StringstyleId
Identifier associated with component.
protected Stringtabindex
Tab index value.
Stringtitle
The advisory title of this element.
StringtitleKey
The message resources key of the advisory title.
booleantriedJstlInit
booleantriedJstlSuccess
Method Summary
protected booleandoErrorsExist()
Determine if there are errors for the component.
StringgetAccesskey()
Returns the accessKey character.
StringgetAlt()
Returns the alternate text attribute.
StringgetAltKey()
Returns the message resources key of the alternate text.
StringgetBundle()
Returns the name of the message resources bundle to use.
booleangetDisabled()
Returns the disabled event handler.
protected StringgetElementClose()
Returns the closing brace for an input element depending on xhtml status.
StringgetErrorKey()
Returns the error key attribute.
StringgetErrorStyle()
Returns the error style attribute.
StringgetErrorStyleClass()
Returns the error style class attribute.
StringgetErrorStyleId()
Returns the error style id attribute.
booleangetIndexed()
Returns the indexed value.
protected intgetIndexValue()
Returns the index value for tags with 'true' value in 'indexed' attribute.
IntegergetJstlLoopIndex()
StringgetLocale()
Returns the name of the session attribute for our locale.
StringgetOnblur()
Returns the onBlur event handler.
StringgetOnchange()
Returns the onChange event handler.
StringgetOnclick()
Returns the onClick event handler.
StringgetOndblclick()
Returns the onDblClick event handler.
StringgetOnfocus()
Returns the onFocus event handler.
StringgetOnkeydown()
Returns the onKeyDown event handler.
StringgetOnkeypress()
Returns the onKeyPress event handler.
StringgetOnkeyup()
Returns the onKeyUp event handler.
StringgetOnmousedown()
Returns the onMouseDown event handler.
StringgetOnmousemove()
Returns the onMouseMove event handler.
StringgetOnmouseout()
Returns the onMouseOut event handler.
StringgetOnmouseover()
Returns the onMouseOver event handler.
StringgetOnmouseup()
Returns the onMouseUp event handler.
StringgetOnselect()
Returns the onSelect event handler.
booleangetReadonly()
Returns the readonly event handler.
StringgetStyle()
Returns the style attribute.
StringgetStyleClass()
Returns the style class attribute.
StringgetStyleId()
Returns the style id attribute.
StringgetTabindex()
Returns the tabIndex value.
StringgetTitle()
Returns the advisory title attribute.
StringgetTitleKey()
Returns the message resources key of the advisory title.
protected booleanisXhtml()
Allows HTML tags to find out if they're nested within an %lt;html:html> tag that has xhtml set to true.
protected StringlookupProperty(String beanName, String property)
Searches all scopes for the bean and calls BeanUtils.getProperty() with the given arguments and converts any exceptions into JspException.
protected Stringmessage(String literal, String key)
Return the text specified by the literal value or the message resources key, if any; otherwise return null.
protected voidprepareAttribute(StringBuffer handlers, String name, Object value)
Prepares an attribute if the value is not null, appending it to the the given StringBuffer.
protected StringprepareEventHandlers()
Prepares the event handlers for inclusion in the component's HTML tag.
protected voidprepareFocusEvents(StringBuffer handlers)
Prepares the focus event handlers, appending them to the the given StringBuffer.
protected voidprepareIndex(StringBuffer handlers, String name)
Appends bean name with index in brackets for tags with 'true' value in 'indexed' attribute.
protected voidprepareKeyEvents(StringBuffer handlers)
Prepares the keyboard event handlers, appending them to the the given StringBuffer.
protected voidprepareMouseEvents(StringBuffer handlers)
Prepares the mouse event handlers, appending them to the the given StringBuffer.
protected StringprepareName()
Prepares the actual name of the component.
protected voidprepareOtherAttributes(StringBuffer handlers)
'Hook' to enable tags to be extended and additional attributes added.
protected StringprepareStyles()
Prepares the style attributes for inclusion in the component's HTML tag.
protected voidprepareTextEvents(StringBuffer handlers)
Prepares the text event handlers, appending them to the the given StringBuffer.
voidrelease()
Release any acquired resources.
voidsetAccesskey(String accessKey)
Sets the accessKey character.
voidsetAlt(String alt)
Sets the alternate text attribute.
voidsetAltKey(String altKey)
Sets the message resources key of the alternate text.
voidsetBundle(String bundle)
Sets the name of the message resources bundle to use.
voidsetDisabled(boolean disabled)
Sets the disabled event handler.
voidsetErrorKey(String errorKey)
Sets the error key attribute.
voidsetErrorStyle(String errorStyle)
Sets the error style attribute.
voidsetErrorStyleClass(String errorStyleClass)
Sets the error style class attribute.
voidsetErrorStyleId(String errorStyleId)
Sets the error style id attribute.
voidsetIndexed(boolean indexed)
Sets the indexed value.
voidsetLocale(String locale)
Sets the name of the session attribute for our locale.
voidsetOnblur(String onBlur)
Sets the onBlur event handler.
voidsetOnchange(String onChange)
Sets the onChange event handler.
voidsetOnclick(String onClick)
Sets the onClick event handler.
voidsetOndblclick(String onDblClick)
Sets the onDblClick event handler.
voidsetOnfocus(String onFocus)
Sets the onFocus event handler.
voidsetOnkeydown(String onKeyDown)
Sets the onKeyDown event handler.
voidsetOnkeypress(String onKeyPress)
Sets the onKeyPress event handler.
voidsetOnkeyup(String onKeyUp)
Sets the onKeyUp event handler.
voidsetOnmousedown(String onMouseDown)
Sets the onMouseDown event handler.
voidsetOnmousemove(String onMouseMove)
Sets the onMouseMove event handler.
voidsetOnmouseout(String onMouseOut)
Sets the onMouseOut event handler.
voidsetOnmouseover(String onMouseOver)
Sets the onMouseOver event handler.
voidsetOnmouseup(String onMouseUp)
Sets the onMouseUp event handler.
voidsetOnselect(String onSelect)
Sets the onSelect event handler.
voidsetReadonly(boolean readonly)
Sets the readonly event handler.
voidsetStyle(String style)
Sets the style attribute.
voidsetStyleClass(String styleClass)
Sets the style class attribute.
voidsetStyleId(String styleId)
Sets the style id attribute.
voidsetTabindex(String tabIndex)
Sets the tabIndex value.
voidsetTitle(String title)
Sets the advisory title attribute.
voidsetTitleKey(String titleKey)
Sets the message resources key of the advisory title.

Field Detail

accesskey

protected String accesskey
Access key character.

alt

private String alt
The alternate text of this element.

altKey

private String altKey
The message resources key of the alternate text.

bundle

private String bundle
The name of the message resources bundle for message lookups.

defaultLocale

protected static final Locale defaultLocale

Deprecated: Use Locale.getDefault() directly.

The default Locale for our server.

disabled

private boolean disabled
Component is disabled.

doDisabled

protected boolean doDisabled
Indicates whether 'disabled' is a valid attribute

doReadonly

protected boolean doReadonly

Indicates whether 'readonly' is a valid attribute.

According to the HTML 4.0 Specification <readonly> is valid for <input type="text">, <input type="password"> and <textarea"> elements. Therefore, except for those tags this value is set to false.

errorKey

private String errorKey
The request attribute key for our error messages (if any).

errorStyle

private String errorStyle
Style attribute associated with component when errors exist.

errorStyleClass

private String errorStyleClass
Named Style class associated with component when errors exist.

errorStyleId

private String errorStyleId
Identifier associated with component when errors exist.

indexed

protected boolean indexed
Whether to created indexed names for fields

Since: Struts 1.1

locale

private String locale
The name of the session attribute key for our locale.

log

private static Log log
Commons Logging instance.

loopTagStatusClass

private Class loopTagStatusClass

loopTagStatusGetIndex

private Method loopTagStatusGetIndex

loopTagSupportClass

private Class loopTagSupportClass

loopTagSupportGetStatus

private Method loopTagSupportGetStatus

messages

protected static MessageResources messages
The message resources for this package.

onblur

private String onblur
Component lost focus event.

onchange

private String onchange
Content changed after component lost focus event.

onclick

private String onclick
Mouse click event.

ondblclick

private String ondblclick
Mouse double click event.

onfocus

private String onfocus
Component has received focus event.

onkeydown

private String onkeydown
Key down in component event.

onkeypress

private String onkeypress
Key down and up together in component event.

onkeyup

private String onkeyup
Key released in component event.

onmousedown

private String onmousedown
Mouse pressed on component event.

onmousemove

private String onmousemove
Mouse moved over component event.

onmouseout

private String onmouseout
Mouse exit component event.

onmouseover

private String onmouseover
Mouse over component event.

onmouseup

private String onmouseup
Mouse released on component event.

onselect

private String onselect
Text selected in component event.

readonly

private boolean readonly
Component is readonly.

style

private String style
Style attribute associated with component.

styleClass

private String styleClass
Named Style class associated with component.

styleId

private String styleId
Identifier associated with component.

tabindex

protected String tabindex
Tab index value.

title

private String title
The advisory title of this element.

titleKey

private String titleKey
The message resources key of the advisory title.

triedJstlInit

private boolean triedJstlInit

triedJstlSuccess

private boolean triedJstlSuccess

Method Detail

doErrorsExist

protected boolean doErrorsExist()
Determine if there are errors for the component.

Returns: Whether errors exist.

getAccesskey

public String getAccesskey()
Returns the accessKey character.

getAlt

public String getAlt()
Returns the alternate text attribute.

getAltKey

public String getAltKey()
Returns the message resources key of the alternate text.

getBundle

public String getBundle()
Returns the name of the message resources bundle to use.

getDisabled

public boolean getDisabled()
Returns the disabled event handler.

getElementClose

protected String getElementClose()
Returns the closing brace for an input element depending on xhtml status. The tag must be nested within an %lt;html:html> tag that has xhtml set to true.

Returns: String - > if xhtml is false, /> if xhtml is true

Since: Struts 1.1

getErrorKey

public String getErrorKey()
Returns the error key attribute.

getErrorStyle

public String getErrorStyle()
Returns the error style attribute.

getErrorStyleClass

public String getErrorStyleClass()
Returns the error style class attribute.

getErrorStyleId

public String getErrorStyleId()
Returns the error style id attribute.

getIndexed

public boolean getIndexed()
Returns the indexed value.

Since: Struts 1.1

getIndexValue

protected int getIndexValue()
Returns the index value for tags with 'true' value in 'indexed' attribute.

Returns: the index value.

Throws: JspException if 'indexed' tag used outside of iterate tag.

getJstlLoopIndex

private Integer getJstlLoopIndex()

getLocale

public String getLocale()
Returns the name of the session attribute for our locale.

getOnblur

public String getOnblur()
Returns the onBlur event handler.

getOnchange

public String getOnchange()
Returns the onChange event handler.

getOnclick

public String getOnclick()
Returns the onClick event handler.

getOndblclick

public String getOndblclick()
Returns the onDblClick event handler.

getOnfocus

public String getOnfocus()
Returns the onFocus event handler.

getOnkeydown

public String getOnkeydown()
Returns the onKeyDown event handler.

getOnkeypress

public String getOnkeypress()
Returns the onKeyPress event handler.

getOnkeyup

public String getOnkeyup()
Returns the onKeyUp event handler.

getOnmousedown

public String getOnmousedown()
Returns the onMouseDown event handler.

getOnmousemove

public String getOnmousemove()
Returns the onMouseMove event handler.

getOnmouseout

public String getOnmouseout()
Returns the onMouseOut event handler.

getOnmouseover

public String getOnmouseover()
Returns the onMouseOver event handler.

getOnmouseup

public String getOnmouseup()
Returns the onMouseUp event handler.

getOnselect

public String getOnselect()
Returns the onSelect event handler.

getReadonly

public boolean getReadonly()
Returns the readonly event handler.

getStyle

public String getStyle()
Returns the style attribute.

getStyleClass

public String getStyleClass()
Returns the style class attribute.

getStyleId

public String getStyleId()
Returns the style id attribute.

getTabindex

public String getTabindex()
Returns the tabIndex value.

getTitle

public String getTitle()
Returns the advisory title attribute.

getTitleKey

public String getTitleKey()
Returns the message resources key of the advisory title.

isXhtml

protected boolean isXhtml()
Allows HTML tags to find out if they're nested within an %lt;html:html> tag that has xhtml set to true.

Returns: true if the tag is nested within an html tag with xhtml set to true, false otherwise.

Since: Struts 1.1

lookupProperty

protected String lookupProperty(String beanName, String property)
Searches all scopes for the bean and calls BeanUtils.getProperty() with the given arguments and converts any exceptions into JspException.

Parameters: beanName The name of the object to get the property from. property The name of the property to get.

Returns: The value of the property.

Throws: JspException

Since: Struts 1.1

message

protected String message(String literal, String key)
Return the text specified by the literal value or the message resources key, if any; otherwise return null.

Parameters: literal Literal text value or null key Message resources key or null

Throws: JspException if both arguments are non-null

prepareAttribute

protected void prepareAttribute(StringBuffer handlers, String name, Object value)
Prepares an attribute if the value is not null, appending it to the the given StringBuffer.

Parameters: handlers The StringBuffer that output will be appended to.

prepareEventHandlers

protected String prepareEventHandlers()
Prepares the event handlers for inclusion in the component's HTML tag.

Returns: The prepared String for inclusion in the HTML tag.

prepareFocusEvents

protected void prepareFocusEvents(StringBuffer handlers)
Prepares the focus event handlers, appending them to the the given StringBuffer.

Parameters: handlers The StringBuffer that output will be appended to.

prepareIndex

protected void prepareIndex(StringBuffer handlers, String name)
Appends bean name with index in brackets for tags with 'true' value in 'indexed' attribute.

Parameters: handlers The StringBuffer that output will be appended to.

Throws: JspException if 'indexed' tag used outside of iterate tag.

prepareKeyEvents

protected void prepareKeyEvents(StringBuffer handlers)
Prepares the keyboard event handlers, appending them to the the given StringBuffer.

Parameters: handlers The StringBuffer that output will be appended to.

prepareMouseEvents

protected void prepareMouseEvents(StringBuffer handlers)
Prepares the mouse event handlers, appending them to the the given StringBuffer.

Parameters: handlers The StringBuffer that output will be appended to.

prepareName

protected String prepareName()
Prepares the actual name of the component.

Returns: The actual component name.

prepareOtherAttributes

protected void prepareOtherAttributes(StringBuffer handlers)
'Hook' to enable tags to be extended and additional attributes added.

Parameters: handlers The StringBuffer that output will be appended to.

prepareStyles

protected String prepareStyles()
Prepares the style attributes for inclusion in the component's HTML tag.

Returns: The prepared String for inclusion in the HTML tag.

Throws: JspException if invalid attributes are specified

prepareTextEvents

protected void prepareTextEvents(StringBuffer handlers)
Prepares the text event handlers, appending them to the the given StringBuffer.

Parameters: handlers The StringBuffer that output will be appended to.

release

public void release()
Release any acquired resources.

setAccesskey

public void setAccesskey(String accessKey)
Sets the accessKey character.

setAlt

public void setAlt(String alt)
Sets the alternate text attribute.

setAltKey

public void setAltKey(String altKey)
Sets the message resources key of the alternate text.

setBundle

public void setBundle(String bundle)
Sets the name of the message resources bundle to use.

setDisabled

public void setDisabled(boolean disabled)
Sets the disabled event handler.

setErrorKey

public void setErrorKey(String errorKey)
Sets the error key attribute.

setErrorStyle

public void setErrorStyle(String errorStyle)
Sets the error style attribute.

setErrorStyleClass

public void setErrorStyleClass(String errorStyleClass)
Sets the error style class attribute.

setErrorStyleId

public void setErrorStyleId(String errorStyleId)
Sets the error style id attribute.

setIndexed

public void setIndexed(boolean indexed)
Sets the indexed value.

Since: Struts 1.1

setLocale

public void setLocale(String locale)
Sets the name of the session attribute for our locale.

setOnblur

public void setOnblur(String onBlur)
Sets the onBlur event handler.

setOnchange

public void setOnchange(String onChange)
Sets the onChange event handler.

setOnclick

public void setOnclick(String onClick)
Sets the onClick event handler.

setOndblclick

public void setOndblclick(String onDblClick)
Sets the onDblClick event handler.

setOnfocus

public void setOnfocus(String onFocus)
Sets the onFocus event handler.

setOnkeydown

public void setOnkeydown(String onKeyDown)
Sets the onKeyDown event handler.

setOnkeypress

public void setOnkeypress(String onKeyPress)
Sets the onKeyPress event handler.

setOnkeyup

public void setOnkeyup(String onKeyUp)
Sets the onKeyUp event handler.

setOnmousedown

public void setOnmousedown(String onMouseDown)
Sets the onMouseDown event handler.

setOnmousemove

public void setOnmousemove(String onMouseMove)
Sets the onMouseMove event handler.

setOnmouseout

public void setOnmouseout(String onMouseOut)
Sets the onMouseOut event handler.

setOnmouseover

public void setOnmouseover(String onMouseOver)
Sets the onMouseOver event handler.

setOnmouseup

public void setOnmouseup(String onMouseUp)
Sets the onMouseUp event handler.

setOnselect

public void setOnselect(String onSelect)
Sets the onSelect event handler.

setReadonly

public void setReadonly(boolean readonly)
Sets the readonly event handler.

setStyle

public void setStyle(String style)
Sets the style attribute.

setStyleClass

public void setStyleClass(String styleClass)
Sets the style class attribute.

setStyleId

public void setStyleId(String styleId)
Sets the style id attribute.

setTabindex

public void setTabindex(String tabIndex)
Sets the tabIndex value.

setTitle

public void setTitle(String title)
Sets the advisory title attribute.

setTitleKey

public void setTitleKey(String titleKey)
Sets the message resources key of the advisory title.
Copyright B) 2000-2008 - The Apache Software Foundation