类 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
- 所有已实现的接口:
Serializable
,DynamicAttributes
,IterationTag
,JspTag
,Tag
,TryCatchFinally
,EditorAwareTag
public class LabelTag extends AbstractHtmlElementTag
The<label>
tag renders a form field label in an HTML 'label' tag.See the "formTags" showcase application that ships with the full Spring distribution for an example of this class in action.
Attribute Summary Attribute Required? Runtime Expression? Description cssClass
false
true
HTML Optional Attribute.
cssErrorClass
false
true
HTML Optional Attribute. Used only when errors are present.
cssStyle
false
true
HTML Optional Attribute
dir
false
true
HTML Standard Attribute
for
false
true
HTML Standard Attribute
htmlEscape
false
true
Enable/disable HTML escaping of rendered values.
id
false
true
HTML Standard Attribute
lang
false
true
HTML Standard Attribute
onclick
false
true
HTML Event Attribute
ondblclick
false
true
HTML Event Attribute
onkeydown
false
true
HTML Event Attribute
onkeypress
false
true
HTML Event Attribute
onkeyup
false
true
HTML Event Attribute
onmousedown
false
true
HTML Event Attribute
onmousemove
false
true
HTML Event Attribute
onmouseout
false
true
HTML Event Attribute
onmouseover
false
true
HTML Event Attribute
onmouseup
false
true
HTML Event Attribute
path
true
true
Path to errors object for data binding
tabindex
false
true
HTML Standard Attribute
title
false
true
HTML Standard Attribute
- 从以下版本开始:
- 2.0
- 作者:
- Rob Harrop, Juergen Hoeller
- 另请参阅:
- 序列化表格
字段概要
从类继承的字段 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
从类继承的字段 org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag
NESTED_PATH_VARIABLE_NAME
从类继承的字段 org.springframework.web.servlet.tags.RequestContextAwareTag
logger, REQUEST_CONTEXT_PAGE_ATTRIBUTE
从类继承的字段 javax.servlet.jsp.tagext.TagSupport
pageContext
从接口继承的字段 javax.servlet.jsp.tagext.IterationTag
EVAL_BODY_AGAIN
从接口继承的字段 javax.servlet.jsp.tagext.Tag
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE
构造器概要
构造器 构造器 说明 LabelTag()
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 protected String
autogenerateFor()
Autogenerate the 'for
' attribute value for this tag.int
doEndTag()
Close the 'label
' tag.void
doFinally()
Disposes of theTagWriter
instance.protected String
getFor()
Get the value of the 'id
' attribute.protected String
getName()
Overrides#getName()
to always returnnull
, 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.从类继承的方法 org.springframework.web.servlet.tags.form.AbstractHtmlElementTag
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, writeOptionalAttributes
从类继承的方法 org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag
autogenerateId, convertToDisplayString, getBindStatus, getBoundValue, getEditor, getId, getNestedPath, getPath, getPropertyEditor, getPropertyPath, processFieldValue, resolveId, setId, setPath
从类继承的方法 org.springframework.web.servlet.tags.form.AbstractFormTag
createTagWriter, doStartTagInternal, evaluate, getDisplayString, getDisplayString, isDefaultHtmlEscape, writeOptionalAttribute
从类继承的方法 org.springframework.web.servlet.tags.HtmlEscapingAwareTag
htmlEscape, isHtmlEscape, isResponseEncodedHtmlEscape, setHtmlEscape
从类继承的方法 org.springframework.web.servlet.tags.RequestContextAwareTag
doCatch, doStartTag, getRequestContext
从类继承的方法 javax.servlet.jsp.tagext.TagSupport
doAfterBody, findAncestorWithClass, getParent, getValue, getValues, release, removeValue, setPageContext, setParent, setValue
构造器详细资料
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.
getFor
@Nullable protected 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.
getName
@Nullable protected String getName() throws JspException
Overrides#getName()
to always returnnull
, because the 'name
' attribute is not supported by the 'label
' tag.- 覆盖:
getName
在类中AbstractDataBoundFormElementTag
- 返回:
- the value for the HTML '
name
' attribute - 抛出:
JspException
resolveFor
protected String resolveFor() throws JspException
Determine the 'for
' attribute value for this tag, autogenerating one if none specified.- 抛出:
JspException
- 另请参阅:
getFor()
,autogenerateFor()
autogenerateFor
protected String autogenerateFor() throws JspException
Autogenerate the 'for
' attribute value for this tag.The default implementation delegates to
AbstractDataBoundFormElementTag.getPropertyPath()
, deleting invalid characters (such as "[" or "]").- 抛出:
JspException
doEndTag
public int doEndTag() throws JspException
Close the 'label
' tag.- 指定者:
doEndTag
在接口中Tag
- 覆盖:
doEndTag
在类中TagSupport
- 抛出:
JspException
doFinally
public void doFinally()
Disposes of theTagWriter
instance.- 指定者:
doFinally
在接口中TryCatchFinally
- 覆盖:
doFinally
在类中AbstractDataBoundFormElementTag