public class InputOptionTag extends InputTagSupport implements javax.servlet.jsp.tagext.BodyTag
Generates an <option value="foo">Fooey</option> HTML tag. Coordinates with an enclosing select tag to determine it's state (i.e. whether or not it is selected.) As a result some of the logic regarding state repopulation is a bit complex.
Since options can have only a single value per option the value attribute of the tag must be a scalar, which will be converted into a String using a Formatter if an appropriate one can be found, otherwise the toString() method will be invoked. The presence of a "selected" attribute is used as an indication that this option believes it should be selected by default - the value (as opposed to the presence) of the selected attribute is never used....
The option tag delegates to its enclosing select tag to determine whether or not it should
be selected. See the "select tag"
for documentation on how it
determines selection status. If the select tag has no opinion on selection state
(note that this is not the same as select tag deeming the option should not be selected) then
the presence of the selected attribute (or lack thereof) is used to turn selection on or off.
If the option has a body then the String value of that body will be used to generate the body of the generated HTML option. If the body is empty or not present then the label attribute will be written into the body of the tag.
errorRenderer, fieldErrors
pageContext, parentTag
Constructor and Description |
---|
InputOptionTag() |
Modifier and Type | Method and Description |
---|---|
int |
doAfterBody()
Does nothing.
|
int |
doEndInputTag()
Locates the option's parent select tag, determines selection state and then writes out
an option tag with an appropriate body.
|
void |
doInitBody()
Does nothing.
|
int |
doStartInputTag()
Does nothing.
|
java.lang.String |
getLabel()
Returns the value set with setLabel().
|
java.lang.String |
getSelected()
Returns the value set with setSelected().
|
java.lang.Object |
getValue()
Returns the value of the option as set with setValue().
|
protected void |
registerWithParentForm()
Overridden to make sure that options do not try and register themselves with
the form tag.
|
void |
setLabel(java.lang.String label)
Sets the label that will be used as the option body if no body is supplied.
|
void |
setSelected(java.lang.String selected)
Sets whether or not this option believes it should be selected by default.
|
void |
setValue(java.lang.Object value)
Sets the value of this option.
|
doCatch, doEndTag, doFinally, doStartTag, format, format, getActionBean, getDisabled, getFieldErrors, getFormatPattern, getFormatType, getLocalizedFieldName, getLocalizedFieldName, getName, getOverrideValueOrValues, getParentFormTag, getReadonly, getSingleOverrideValue, getSize, getValidationMetadata, getValueOnPage, hasErrors, isItemSelected, loadErrors, makeFocused, setDisabled, setFocus, setFormatPattern, setFormatType, setName, setReadonly, setSize
evaluateExpression, get, getAccesskey, getAttributes, getBodyContent, getBodyContentAsString, getCssClass, getDir, getId, getLang, getOnblur, getOnchange, getOnclick, getOndblclick, getOnfocus, getOnkeydown, getOnkeypress, getOnkeyup, getOnmousedown, getOnmousemove, getOnmouseout, getOnmouseover, getOnmouseup, getOnselect, getStyle, getTabindex, getTitle, release, set, setAccesskey, setBodyContent, setClass, setCssClass, setDir, setDynamicAttribute, setId, setLang, setOnblur, setOnchange, setOnclick, setOndblclick, setOnfocus, setOnkeydown, setOnkeypress, setOnkeyup, setOnmousedown, setOnmousemove, setOnmouseout, setOnmouseover, setOnmouseup, setOnselect, setStyle, setTabindex, setTitle, toString, writeAttributes, writeCloseTag, writeOpenTag, writeSingletonTag
getActionBeanType, getActionBeanUrl, getPageContext, getParent, getParentTag, getTagStack, popPageContextAttributes, pushPageContextAttributes, setPageContext, setParent
public void setValue(java.lang.Object value)
public java.lang.Object getValue()
public void setLabel(java.lang.String label)
public java.lang.String getLabel()
public void setSelected(java.lang.String selected)
public java.lang.String getSelected()
public int doStartInputTag() throws javax.servlet.jsp.JspException
doStartInputTag
in class InputTagSupport
javax.servlet.jsp.JspException
public void doInitBody() throws javax.servlet.jsp.JspException
doInitBody
in interface javax.servlet.jsp.tagext.BodyTag
javax.servlet.jsp.JspException
public int doAfterBody() throws javax.servlet.jsp.JspException
doAfterBody
in interface javax.servlet.jsp.tagext.IterationTag
javax.servlet.jsp.JspException
public int doEndInputTag() throws javax.servlet.jsp.JspException
doEndInputTag
in class InputTagSupport
javax.servlet.jsp.JspException
- if the option is not contained inside an InputSelectTag or output
cannot be written.protected void registerWithParentForm() throws StripesJspException
registerWithParentForm
in class InputTagSupport
StripesJspException
- if the parent form tag is not found? Copyright 2005-2006, Stripes Development Team.