org.apache.struts.taglib.html

Class RadioTag

public class RadioTag extends BaseHandlerTag

Tag for input fields of type "radio".

Version: $Rev: 190779 $ $Date: 2005-06-15 18:04:44 +0100 (Wed, 15 Jun 2005) $

Field Summary
protected StringidName
Name of the bean (in some scope) that will return the value of the radio tag.
protected static MessageResourcesmessages
The message resources for this package.
protected Stringname
The name of the bean containing our underlying property.
protected Stringproperty
The property name for this field.
protected Stringtext
The body content of this tag (if any).
protected Stringvalue
The server value for this option.
Method Summary
StringcurrentValue()
Acquire the current value of the bean specified by the name attribute and the property specified by the property attribute.
intdoAfterBody()
Save the associated label from the body content.
intdoEndTag()
Optionally render the associated label from the body content.
intdoStartTag()
Generate the required input tag.
StringgetIdName()
Return the idName.
StringgetName()
StringgetProperty()
Return the property name.
StringgetValue()
Return the server value.
protected StringprepareName()
Prepare the name element
voidrelease()
Release any acquired resources.
protected StringrenderRadioElement(String serverValue, String checkedValue)
Renders an HTML <input type="radio"> element.
StringserverValue()
Return the String to be used in the radio tag's value attribute that gets sent to the server on form submission.
voidsetIdName(String idName)
Set the idName.
voidsetName(String name)
voidsetProperty(String property)
Set the property name.
voidsetValue(String value)
Set the server value.

Field Detail

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 Detail

currentValue

private String currentValue()
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.

Throws: JspException

doAfterBody

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

Throws: JspException if a JSP exception has occurred

doEndTag

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

Throws: JspException if a JSP exception has occurred

doStartTag

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

Throws: JspException if a JSP exception has occurred

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.

prepareName

protected String prepareName()
Prepare the name element

Returns: The element name.

release

public void release()
Release any acquired resources.

renderRadioElement

protected String renderRadioElement(String serverValue, String checkedValue)
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.

Throws: JspException

Since: Struts 1.1

serverValue

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.

Throws: JspException

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-2009 - The Apache Software Foundation