public class OptionTag extends AbstractHtmlElementBodyTag implements BodyTag
option
' tag.
Must be used nested inside a SelectTag
.
Provides full support for databinding by marking an
'option
' as 'selected' if the value
matches the value bound to the out SelectTag
.
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 no label
is specified
then the value
property will be used when rendering
the inner text.
Modifier and Type | Field and Description |
---|---|
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.
|
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
COMMAND_NAME_VARIABLE_NAME, NESTED_PATH_VARIABLE_NAME
logger, REQUEST_CONTEXT_PAGE_ATTRIBUTE
pageContext
EVAL_BODY_BUFFERED, EVAL_BODY_TAG
EVAL_BODY_AGAIN
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE
Constructor and Description |
---|
OptionTag() |
Modifier and Type | Method and Description |
---|---|
protected String |
autogenerateId()
Autogenerate the '
id ' attribute value for this tag. |
protected void |
exposeAttributes()
Called during
AbstractHtmlElementBodyTag.writeTagContent(org.springframework.web.servlet.tags.form.TagWriter) allowing subclasses to add any attributes to the
PageContext as needed. |
protected BindStatus |
getBindStatus()
Get the
BindStatus for this tag. |
protected String |
getDisabled()
Get the value of the '
disabled ' attribute. |
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()
Is the current HTML tag disabled?
|
protected void |
onWriteTagContent()
Make sure we are under a '
select ' tag before proceeding. |
protected void |
removeAttributes()
Called by
AbstractHtmlElementBodyTag.doFinally() allowing subclasses to remove any attributes from the
PageContext as needed. |
protected void |
renderDefaultContent(TagWriter tagWriter) |
protected void |
renderFromBodyContent(BodyContent bodyContent,
TagWriter tagWriter)
Render the tag contents based on the supplied
BodyContent . |
void |
setDisabled(String 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. |
doEndTag, doFinally, doInitBody, flushBufferedBodyContent, setBodyContent, shouldRender, writeTagContent
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
convertToDisplayString, getBoundValue, getEditor, getId, getName, getNestedPath, getPath, getPropertyEditor, getPropertyPath, processFieldValue, resolveId, setId, setPath
createTagWriter, doStartTagInternal, evaluate, evaluateBoolean, getDisplayString, getDisplayString, isDefaultHtmlEscape, writeOptionalAttribute
isHtmlEscape, setHtmlEscape
doCatch, doStartTag, getRequestContext
doAfterBody, findAncestorWithClass, getParent, getValue, getValues, release, removeValue, setPageContext, setParent, setValue
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
doInitBody, setBodyContent
doAfterBody
doEndTag, doStartTag, getParent, release, setPageContext, setParent
public static final String VALUE_VARIABLE_NAME
public static final String DISPLAY_VALUE_VARIABLE_NAME
public void setValue(Object value)
<option>
tag.
May be a runtime expression.
protected Object getValue()
<option>
tag.public void setDisabled(String disabled)
disabled
' attribute.
May be a runtime expression.
disabled
- the value of the 'disabled
' attributeprotected String getDisabled()
disabled
' attribute.protected boolean isDisabled() throws JspException
true
if this tag is disabledJspException
public void setLabel(String label)
<option>
tag.
May be a runtime expression.
protected String getLabel()
<option>
tag.protected void renderDefaultContent(TagWriter tagWriter) throws JspException
renderDefaultContent
in class AbstractHtmlElementBodyTag
JspException
protected void renderFromBodyContent(BodyContent bodyContent, TagWriter tagWriter) throws JspException
AbstractHtmlElementBodyTag
BodyContent
.
The default implementation simply flushes
the BodyContent
directly to the output. Subclasses may choose to
override this to add additional content to the output.
renderFromBodyContent
in class AbstractHtmlElementBodyTag
JspException
protected void onWriteTagContent()
select
' tag before proceeding.onWriteTagContent
in class AbstractHtmlElementBodyTag
protected void exposeAttributes() throws JspException
AbstractHtmlElementBodyTag
AbstractHtmlElementBodyTag.writeTagContent(org.springframework.web.servlet.tags.form.TagWriter)
allowing subclasses to add any attributes to the
PageContext
as needed.exposeAttributes
in class AbstractHtmlElementBodyTag
JspException
protected BindStatus getBindStatus()
AbstractDataBoundFormElementTag
BindStatus
for this tag.getBindStatus
in class AbstractDataBoundFormElementTag
protected void removeAttributes()
AbstractHtmlElementBodyTag
AbstractHtmlElementBodyTag.doFinally()
allowing subclasses to remove any attributes from the
PageContext
as needed.removeAttributes
in class AbstractHtmlElementBodyTag
protected String autogenerateId() throws JspException
AbstractDataBoundFormElementTag
id
' attribute value for this tag.
The default implementation simply delegates to AbstractDataBoundFormElementTag.getName()
,
deleting invalid characters (such as "[" or "]").
autogenerateId
in class AbstractDataBoundFormElementTag
JspException