org.apache.struts.taglib.html

Class RadioTag

Known Direct Subclasses:
NestedRadioTag

public class RadioTag
extends BaseHandlerTag

Tag for input fields of type "radio".

Version:
$Revision: 1.23 $ $Date: 2003/05/18 18:57:13 $

Authors:
Craig R. McClanahan
Ted Husted
David Graham

Field Summary

protected String
idName
Name of the bean (in some scope) that will return the value of the radio tag.
protected static MessageResources
messages
The message resources for this package.
protected String
name
The name of the bean containing our underlying property.
protected String
property
The property name for this field.
protected String
text
The body content of this tag (if any).
protected String
value
The server value for this option.

Fields inherited from class org.apache.struts.taglib.html.BaseHandlerTag

accesskey, alt, altKey, bundle, defaultLocale, disabled, indexed, locale, log, loopTagStatusClass, loopTagStatusGetIndex, loopTagSupportClass, loopTagSupportGetStatus, messages, onblur, onchange, onclick, ondblclick, onfocus, onkeydown, onkeypress, onkeyup, onmousedown, onmousemove, onmouseout, onmouseover, onmouseup, onselect, readonly, style, styleClass, styleId, tabindex, title, titleKey, triedJstlInit, triedJstlSuccess

Method Summary

private String
currentValue()
Acquire the current value of the bean specified by the name attribute and the property specified by the property attribute.
int
doAfterBody()
Save the associated label from the body content.
int
doEndTag()
Optionally render the associated label from the body content.
int
doStartTag()
Generate the required input tag.
String
getIdName()
Return the idName.
String
getName()
String
getProperty()
Return the property name.
String
getValue()
Return the server value.
void
release()
Release any acquired resources.
protected String
renderRadioElement(String serverValue, String checkedValue)
Renders an HTML <input type="radio"> element.
private String
serverValue()
Return the String to be used in the radio tag's value attribute that gets sent to the server on form submission.
void
setIdName(String idName)
Set the idName.
void
setName(String name)
void
setProperty(String property)
Set the property name.
void
setValue(String value)
Set the server value.

Methods inherited from class org.apache.struts.taglib.html.BaseHandlerTag

getAccesskey, getAlt, getAltKey, getBundle, getDisabled, getElementClose, getIndexed, getJstlLoopIndex, getLocale, getOnblur, getOnchange, getOnclick, getOndblclick, getOnfocus, getOnkeydown, getOnkeypress, getOnkeyup, getOnmousedown, getOnmousemove, getOnmouseout, getOnmouseover, getOnmouseup, getOnselect, getReadonly, getStyle, getStyleClass, getStyleId, getTabindex, getTitle, getTitleKey, isXhtml, lookupProperty, message, prepareEventHandlers, prepareFocusEvents, prepareIndex, prepareKeyEvents, prepareMouseEvents, prepareStyles, prepareTextEvents, release, setAccesskey, setAlt, setAltKey, setBundle, setDisabled, setIndexed, setLocale, setOnblur, setOnchange, setOnclick, setOndblclick, setOnfocus, setOnkeydown, setOnkeypress, setOnkeyup, setOnmousedown, setOnmousemove, setOnmouseout, setOnmouseover, setOnmouseup, setOnselect, setReadonly, setStyle, setStyleClass, setStyleId, setTabindex, setTitle, setTitleKey

Field Details

idName

protected String idName
Name of the bean (in some scope) that will return the value of the radio tag.

If an iterator is used to render a series of radio tags, this field may be used to specify the name of the bean exposed by the iterator. In this case, the value attribute is used as the name of a property on the idName bean that returns the value of the radio tag in this iteration.


messages

protected static MessageResources messages
The message resources for this package.


name

protected String name
The name of the bean containing our underlying property.


property

protected String property
The property name for this field.


text

protected String text
The body content of this tag (if any).


value

protected String value
The server value for this option.

Method Details

currentValue

private String currentValue()
            throws JspException
Acquire the current value of the bean specified by the name attribute and the property specified by the property attribute. This radio button with this value will be checked.


doAfterBody

public int doAfterBody()
            throws JspException
Save the associated label from the body content.


doEndTag

public int doEndTag()
            throws JspException
Optionally render the associated label from the body content.


doStartTag

public int doStartTag()
            throws JspException
Generate the required input tag. [Indexed property since Struts 1.1]


getIdName

public String getIdName()
Return the idName.

Since:
Struts 1.1


getName

public String getName()


getProperty

public String getProperty()
Return the property name.


getValue

public String getValue()
Return the server value.


release

public void release()
Release any acquired resources.
Overrides:
release in interface BaseHandlerTag


renderRadioElement

protected String renderRadioElement(String serverValue,
                                    String checkedValue)
            throws JspException
Renders an HTML <input type="radio"> element.

Parameters:
serverValue - The data to be used in the tag's value attribute and sent to the server when the form is submitted.
checkedValue - If the serverValue equals this value the radio button will be checked.

Returns:
A radio input element.

Since:
Struts 1.1


serverValue

private String serverValue()
            throws JspException
Return the String to be used in the radio tag's value attribute that gets sent to the server on form submission.


setIdName

public void setIdName(String idName)
Set the idName.

Parameters:
idName - The new idName

Since:
Struts 1.1


setName

public void setName(String name)


setProperty

public void setProperty(String property)
Set the property name.

Parameters:
property - The new property name


setValue

public void setValue(String value)
Set the server value.

Parameters:
value - The new server value


Copyright B) 2000-2005 - Apache Software Foundation