public class InputRadioButtonTag extends InputTagSupport implements javax.servlet.jsp.tagext.BodyTag
Generates <input type="radio" value="foo"/> HTML tags based on the attribute set on the tag and the state of the form. Since a single radio button widget on a HTML page can have only a single value, the value tag attribute must be a Scalar object. The value will be converted to a String using the Stripes formatting system (with appropriate defaults), or by calling toString if an appropriate Formatter does not exist. Similarly since radio button sets can have only a single selected value at a time the checked attribute of the tag must also be a scalar value.
Radio buttons perform automatic (re-)population of state. They prefer, in order, the value in the HttpServletRequest, the value in the ActionBean and lastly the value set using checked="" on the page. If the value of the current radio button matches the checked value from the preferred source then the attribute checked="checked" will be written in the HTML tag.
The tag may include a body and if present the body is converted to a String and overrides the checked tag attribute.
errorRenderer, fieldErrorspageContext, parentTag| Constructor and Description |
|---|
InputRadioButtonTag()
Basic constructor that sets the input tag's type attribute to "radio".
|
| Modifier and Type | Method and Description |
|---|---|
int |
doAfterBody()
Does nothing.
|
int |
doEndInputTag()
Determines the state of the set of radio buttons and then writes the radio button to the
output stream with checked="checked" or not as appropriate.
|
void |
doInitBody()
Does nothing.
|
int |
doStartInputTag()
Sets the input tag type to "radio".
|
java.lang.String |
getChecked()
Returns the value set with setChecked().
|
java.lang.Object |
getValue()
Returns the value set with setValue()
|
java.lang.Object |
getValueOnPage()
Returns the body of the tag if it is present and not empty, otherwise returns
the value of the 'checked' attribute.
|
void |
setChecked(java.lang.String checked)
Sets the value amongst a set of radio buttons, that should be "checked" by default.
|
void |
setValue(java.lang.Object value)
Sets the Object value of this individual checkbox.
|
doCatch, doEndTag, doFinally, doStartTag, format, format, getActionBean, getDisabled, getFieldErrors, getFormatPattern, getFormatType, getLocalizedFieldName, getLocalizedFieldName, getName, getOverrideValueOrValues, getParentFormTag, getReadonly, getSingleOverrideValue, getSize, getValidationMetadata, hasErrors, isItemSelected, loadErrors, makeFocused, registerWithParentForm, setDisabled, setFocus, setFormatPattern, setFormatType, setName, setReadonly, setSizeevaluateExpression, 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, writeSingletonTaggetActionBeanType, getActionBeanUrl, getPageContext, getParent, getParentTag, getTagStack, popPageContextAttributes, pushPageContextAttributes, setPageContext, setParentpublic InputRadioButtonTag()
public void setChecked(java.lang.String checked)
checked - the default value for a set of radio buttonspublic java.lang.String getChecked()
public void setValue(java.lang.Object value)
public java.lang.Object getValue()
public int doStartInputTag()
throws javax.servlet.jsp.JspException
doStartInputTag in class InputTagSupportjavax.servlet.jsp.JspExceptionpublic void doInitBody()
throws javax.servlet.jsp.JspException
doInitBody in interface javax.servlet.jsp.tagext.BodyTagjavax.servlet.jsp.JspExceptionpublic int doAfterBody()
throws javax.servlet.jsp.JspException
doAfterBody in interface javax.servlet.jsp.tagext.IterationTagjavax.servlet.jsp.JspExceptionpublic java.lang.Object getValueOnPage()
getValueOnPage in class InputTagSupportpublic int doEndInputTag()
throws javax.servlet.jsp.JspException
doEndInputTag in class InputTagSupportjavax.servlet.jsp.JspException - if the parent form tag cannot be found, or output cannot be written.? Copyright 2005-2006, Stripes Development Team.