org.springframework.web.servlet.tags.form
Class LabelTag
java.lang.Object
javax.servlet.jsp.tagext.TagSupport
org.springframework.web.servlet.tags.RequestContextAwareTag
org.springframework.web.servlet.tags.HtmlEscapingAwareTag
org.springframework.web.servlet.tags.form.AbstractFormTag
org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag
org.springframework.web.servlet.tags.form.AbstractHtmlElementTag
org.springframework.web.servlet.tags.form.LabelTag
- All Implemented Interfaces:
- Serializable, IterationTag, JspTag, Tag, TryCatchFinally
public class LabelTag
- extends AbstractHtmlElementTag
Databinding-aware JSP tag for rendering an HTML '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.
- Since:
- 2.0
- Author:
- Rob Harrop, Juergen Hoeller
- See Also:
- Serialized Form
Fields inherited from class org.springframework.web.servlet.tags.form.AbstractHtmlElementTag |
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_ATTRIBUTE |
Method Summary |
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 the empty string "",
because the 'name ' attribute is not supported by the
'label ' tag. |
protected String |
resolveFor()
Returns the value that must be used for the 'for ' attribute. |
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. |
Methods inherited from class org.springframework.web.servlet.tags.form.AbstractHtmlElementTag |
getCssClass, getCssErrorClass, getCssStyle, getDir, getLang, getOnclick, getOndblclick, getOnkeydown, getOnkeypress, getOnkeyup, getOnmousedown, getOnmousemove, getOnmouseout, getOnmouseover, getOnmouseup, getTabindex, getTitle, resolveCssClass, setCssClass, setCssErrorClass, setCssStyle, setDir, setLang, setOnclick, setOndblclick, setOnkeydown, setOnkeypress, setOnkeyup, setOnmousedown, setOnmousemove, setOnmouseout, setOnmouseover, setOnmouseup, setTabindex, setTitle, writeDefaultAttributes |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
LabelTag
public LabelTag()
setFor
public void setFor(String forId)
- Set the value of the '
for
' attribute.
Defaults to the value of AbstractDataBoundFormElementTag.getPath()
; may be a runtime expression.
- Throws:
IllegalArgumentException
- if the supplied value is null
getFor
public String getFor()
- Get the value of the '
id
' attribute.
May be a runtime expression.
writeTagContent
protected int writeTagContent(TagWriter tagWriter)
throws JspException
- Writes the opening '
label
' tag and forces a block tag so
that body content is written correctly.
- Specified by:
writeTagContent
in class AbstractFormTag
- Returns:
Tag.EVAL_BODY_INCLUDE
- Throws:
JspException
getName
protected String getName()
throws JspException
- Overrides
getName()
to always return the empty string "",
because the 'name
' attribute is not supported by the
'label
' tag.
- Overrides:
getName
in class AbstractDataBoundFormElementTag
- Returns:
- the value for the HTML '
name
' attribute
- Throws:
JspException
resolveFor
protected final String resolveFor()
throws JspException
- Returns the value that must be used for the '
for
' attribute.
- Throws:
JspException
doEndTag
public int doEndTag()
throws JspException
- Close the '
label
' tag.
- Specified by:
doEndTag
in interface Tag
- Overrides:
doEndTag
in class TagSupport
- Returns:
Tag.EVAL_PAGE
- Throws:
JspException
doFinally
public void doFinally()
- Disposes of the
TagWriter
instance.
- Specified by:
doFinally
in interface TryCatchFinally
- Overrides:
doFinally
in class AbstractDataBoundFormElementTag
Copyright © 2002-2007 The Spring Framework.