public class LabelTag extends AbstractHtmlElementTag
label' element
that defines text that is associated with a single form element.
The 'for' attribute is required.
See the "formTags" showcase application that ships with the full Spring distribution for an example of this class in action.
CLASS_ATTRIBUTE, DIR_ATTRIBUTE, LANG_ATTRIBUTE, ONCLICK_ATTRIBUTE, ONDBLCLICK_ATTRIBUTE, ONKEYDOWN_ATTRIBUTE, ONKEYPRESS_ATTRIBUTE, ONKEYUP_ATTRIBUTE, ONMOUSEDOWN_ATTRIBUTE, ONMOUSEMOVE_ATTRIBUTE, ONMOUSEOUT_ATTRIBUTE, ONMOUSEOVER_ATTRIBUTE, ONMOUSEUP_ATTRIBUTE, STYLE_ATTRIBUTE, TABINDEX_ATTRIBUTE, TITLE_ATTRIBUTECOMMAND_NAME_VARIABLE_NAME, NESTED_PATH_VARIABLE_NAMElogger, REQUEST_CONTEXT_PAGE_ATTRIBUTE| Constructor and Description |
|---|
LabelTag() |
| Modifier and Type | Method and Description |
|---|---|
protected String |
autogenerateFor()
Autogenerate the '
for' attribute value for this tag. |
int |
doEndTag()
Close the '
label' tag. |
void |
doFinally()
Disposes of the
TagWriter instance. |
String |
getFor()
Get the value of the '
id' attribute. |
protected String |
getName()
Overrides
getName() to always return null,
because the 'name' attribute is not supported by the
'label' tag. |
protected String |
resolveFor()
Determine the '
for' attribute value for this tag,
autogenerating one if none specified. |
void |
setFor(String forId)
Set the value of the '
for' attribute. |
protected int |
writeTagContent(TagWriter tagWriter)
Writes the opening '
label' tag and forces a block tag so
that body content is written correctly. |
getCssClass, getCssErrorClass, getCssStyle, getDir, getDynamicAttributes, getLang, getOnclick, getOndblclick, getOnkeydown, getOnkeypress, getOnkeyup, getOnmousedown, getOnmousemove, getOnmouseout, getOnmouseover, getOnmouseup, getTabindex, getTitle, isValidDynamicAttribute, resolveCssClass, setCssClass, setCssErrorClass, setCssStyle, setDir, setDynamicAttribute, setLang, setOnclick, setOndblclick, setOnkeydown, setOnkeypress, setOnkeyup, setOnmousedown, setOnmousemove, setOnmouseout, setOnmouseover, setOnmouseup, setTabindex, setTitle, writeDefaultAttributes, writeOptionalAttributesautogenerateId, convertToDisplayString, getBindStatus, getBoundValue, getEditor, getId, getNestedPath, getPath, getPropertyEditor, getPropertyPath, processFieldValue, resolveId, setId, setPathcreateTagWriter, doStartTagInternal, evaluate, evaluateBoolean, getDisplayString, getDisplayString, isDefaultHtmlEscape, writeOptionalAttributeisHtmlEscape, setHtmlEscapedoCatch, doStartTag, getRequestContextpublic void setFor(String forId)
for' attribute.
Defaults to the value of AbstractDataBoundFormElementTag.getPath(); may be a runtime expression.
IllegalArgumentException - if the supplied value is nullpublic String getFor()
id' attribute.
May be a runtime expression.
protected int writeTagContent(TagWriter tagWriter) throws javax.servlet.jsp.JspException
label' tag and forces a block tag so
that body content is written correctly.writeTagContent in class AbstractFormTagTag.EVAL_BODY_INCLUDEjavax.servlet.jsp.JspExceptionprotected String getName() throws javax.servlet.jsp.JspException
getName() to always return null,
because the 'name' attribute is not supported by the
'label' tag.getName in class AbstractDataBoundFormElementTagname' attributejavax.servlet.jsp.JspExceptionprotected String resolveFor() throws javax.servlet.jsp.JspException
for' attribute value for this tag,
autogenerating one if none specified.javax.servlet.jsp.JspExceptiongetFor(),
autogenerateFor()protected String autogenerateFor() throws javax.servlet.jsp.JspException
for' attribute value for this tag.
The default implementation delegates to AbstractDataBoundFormElementTag.getPropertyPath(),
deleting invalid characters (such as "[" or "]").
javax.servlet.jsp.JspExceptionpublic int doEndTag()
throws javax.servlet.jsp.JspException
label' tag.doEndTag in interface javax.servlet.jsp.tagext.TagdoEndTag in class javax.servlet.jsp.tagext.TagSupportjavax.servlet.jsp.JspExceptionpublic void doFinally()
TagWriter instance.doFinally in interface javax.servlet.jsp.tagext.TryCatchFinallydoFinally in class AbstractDataBoundFormElementTagCopyright © 2015. All rights reserved.