类 OptionTag
- java.lang.Object
- 所有已实现的接口:
Serializable
,BodyTag
,DynamicAttributes
,IterationTag
,JspTag
,Tag
,TryCatchFinally
,EditorAwareTag
public class OptionTag extends AbstractHtmlElementBodyTag implements BodyTag
The<option>
tag renders a single HTML 'option'. Sets 'selected' as appropriate based on bound value.Must be used nested inside a
SelectTag
.Provides full support for databinding by marking an '
option
' as 'selected' if thevalue
matches the value bound to the outSelectTag
.The
value
property is required and corresponds to the 'value
' attribute of the rendered 'option
'.An optional
label
property can be specified, the value of which corresponds to inner text of the rendered 'option
' tag. If nolabel
is specified then thevalue
property will be used when rendering the inner text.Attribute Summary Attribute Required? Runtime Expression? Description cssClass
false
true
HTML Optional Attribute
cssErrorClass
false
true
HTML Optional Attribute. Used when the bound field has errors.
cssStyle
false
true
HTML Optional Attribute
dir
false
true
HTML Standard Attribute
disabled
false
true
HTML Optional Attribute. Setting the value of this attribute to 'true' will disable the HTML element.
htmlEscape
false
true
Enable/disable HTML escaping of rendered values.
id
false
true
HTML Standard Attribute
label
false
true
HTML Optional 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
tabindex
false
true
HTML Standard Attribute
title
false
true
HTML Standard Attribute
value
true
true
HTML Optional Attribute
- 从以下版本开始:
- 2.0
- 作者:
- Rob Harrop, Juergen Hoeller
- 另请参阅:
- 序列化表格
字段概要
字段 修饰符和类型 字段 说明 static String
DISPLAY_VALUE_VARIABLE_NAME
The name of the JSP variable used to expose the display value for this tag.static String
VALUE_VARIABLE_NAME
The name of the JSP variable used to expose the value for this tag.从类继承的字段 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.BodyTag
EVAL_BODY_BUFFERED, EVAL_BODY_TAG
从接口继承的字段 javax.servlet.jsp.tagext.IterationTag
EVAL_BODY_AGAIN
从接口继承的字段 javax.servlet.jsp.tagext.Tag
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE
构造器概要
构造器 构造器 说明 OptionTag()
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 protected String
autogenerateId()
Autogenerate the 'id
' attribute value for this tag.protected void
exposeAttributes()
Called duringAbstractHtmlElementBodyTag.writeTagContent(org.springframework.web.servlet.tags.form.TagWriter)
allowing subclasses to add any attributes to thePageContext
as needed.protected BindStatus
getBindStatus()
Get theBindStatus
for this tag.protected String
getLabel()
Get the text body of the rendered HTML<option>
tag.protected Object
getValue()
Get the 'value' attribute of the rendered HTML<option>
tag.protected boolean
isDisabled()
Get the value of the 'disabled
' attribute.protected void
onWriteTagContent()
Make sure we are under a 'select
' tag before proceeding.protected void
removeAttributes()
Called byAbstractHtmlElementBodyTag.doFinally()
allowing subclasses to remove any attributes from thePageContext
as needed.protected void
renderDefaultContent(TagWriter tagWriter)
protected void
renderFromBodyContent(BodyContent bodyContent, TagWriter tagWriter)
Render the tag contents based on the suppliedBodyContent
.void
setDisabled(boolean disabled)
Set the value of the 'disabled
' attribute.void
setLabel(String label)
Set the text body of the rendered HTML<option>
tag.void
setValue(Object value)
Set the 'value' attribute of the rendered HTML<option>
tag.从类继承的方法 org.springframework.web.servlet.tags.form.AbstractHtmlElementBodyTag
doEndTag, doFinally, doInitBody, flushBufferedBodyContent, setBodyContent, shouldRender, writeTagContent
从类继承的方法 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
convertToDisplayString, getBoundValue, getEditor, getId, getName, 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
从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
从接口继承的方法 javax.servlet.jsp.tagext.BodyTag
doInitBody, setBodyContent
从接口继承的方法 javax.servlet.jsp.tagext.IterationTag
doAfterBody
从接口继承的方法 javax.servlet.jsp.tagext.Tag
doEndTag, doStartTag, getParent, release, setPageContext, setParent
字段详细资料
VALUE_VARIABLE_NAME
public static final String VALUE_VARIABLE_NAME
The name of the JSP variable used to expose the value for this tag.- 另请参阅:
- 常量字段值
DISPLAY_VALUE_VARIABLE_NAME
public static final String DISPLAY_VALUE_VARIABLE_NAME
The name of the JSP variable used to expose the display value for this tag.- 另请参阅:
- 常量字段值
构造器详细资料
OptionTag
public OptionTag()
方法详细资料
setValue
public void setValue(Object value)
Set the 'value' attribute of the rendered HTML<option>
tag.
getValue
@Nullable protected Object getValue()
Get the 'value' attribute of the rendered HTML<option>
tag.
setDisabled
public void setDisabled(boolean disabled)
Set the value of the 'disabled
' attribute.
isDisabled
protected boolean isDisabled()
Get the value of the 'disabled
' attribute.
setLabel
public void setLabel(String label)
Set the text body of the rendered HTML<option>
tag.May be a runtime expression.
renderDefaultContent
protected void renderDefaultContent(TagWriter tagWriter) throws JspException
renderFromBodyContent
protected void renderFromBodyContent(BodyContent bodyContent, TagWriter tagWriter) throws JspException
从类复制的说明:AbstractHtmlElementBodyTag
Render the tag contents based on the suppliedBodyContent
.The default implementation simply
flushes
theBodyContent
directly to the output. Subclasses may choose to override this to add additional content to the output.
onWriteTagContent
protected void onWriteTagContent()
Make sure we are under a 'select
' tag before proceeding.
exposeAttributes
protected void exposeAttributes() throws JspException
从类复制的说明:AbstractHtmlElementBodyTag
Called duringAbstractHtmlElementBodyTag.writeTagContent(org.springframework.web.servlet.tags.form.TagWriter)
allowing subclasses to add any attributes to thePageContext
as needed.
getBindStatus
protected BindStatus getBindStatus()
从类复制的说明:AbstractDataBoundFormElementTag
Get theBindStatus
for this tag.
removeAttributes
protected void removeAttributes()
从类复制的说明:AbstractHtmlElementBodyTag
Called byAbstractHtmlElementBodyTag.doFinally()
allowing subclasses to remove any attributes from thePageContext
as needed.
autogenerateId
protected String autogenerateId() throws JspException
从类复制的说明:AbstractDataBoundFormElementTag
Autogenerate the 'id
' attribute value for this tag.The default implementation simply delegates to
AbstractDataBoundFormElementTag.getName()
, deleting invalid characters (such as "[" or "]").