Package org.apache.struts2.components
Class Radio
java.lang.Object
org.apache.struts2.components.Component
org.apache.struts2.components.UIBean
org.apache.struts2.components.ListUIBean
org.apache.struts2.components.Radio
Render a radio button input field.
Examples
In this example, a radio control is displayed with a list of genders. The gender list is built from attribute id=genders. The framework calls getGenders() which will return a Map. For examples using listKey and listValue attributes, see the section select tag. The default selected one will be determined (in this case) by the getMale() method in the action class which should return a value similar to the key of the getGenders() map if that particular gender is to be selected.
 
 <s:action name="GenderMap" var="genders"/>
 <s:radio label="Gender" name="male" list="#genders.genders"/>
 
 
 <@s.radio name="car" list={"ford": "Ford Motor Co", "toyota": "Toyota"} listKey="key" listValue="value" />
 
 - 
Field SummaryFieldsFields inherited from class org.apache.struts2.components.ListUIBeanlist, listCssClass, listCssStyle, listKey, listLabelKey, listTitle, listValue, listValueKey, throwExceptionOnNullValueAttributeFields inherited from class org.apache.struts2.components.UIBeanaccesskey, ATTR_FIELD_VALUE, ATTR_NAME_VALUE, ATTR_VALUE, cssClass, cssErrorClass, cssErrorStyle, cssStyle, defaultTemplateDir, defaultUITheme, disabled, dynamicAttributes, errorPosition, id, javascriptTooltip, key, label, labelPosition, labelSeparator, name, onblur, onchange, onclick, ondblclick, onfocus, onkeydown, onkeypress, onkeyup, onmousedown, onmousemove, onmouseout, onmouseover, onmouseup, onselect, request, requiredLabel, requiredPosition, response, tabindex, template, templateDir, templateEngineManager, templateSuffix, theme, title, tooltip, tooltipConfig, tooltipCssClass, tooltipDelay, tooltipIconPath, uiStaticContentPath, uiThemeExpansionToken, valueFields inherited from class org.apache.struts2.components.ComponentactionMapper, attributes, COMPONENT_STACK, devMode, escapeHtmlBody, performClearTagStateForTagPoolingServers, stack, standardAttributesMap, throwExceptionOnELFailure
- 
Constructor SummaryConstructorsConstructorDescriptionRadio(ValueStack stack, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) 
- 
Method SummaryModifier and TypeMethodDescriptionprotected StringA contract that requires each concrete UI Tag to specify which template should be used as a default.protected booleanRadio tag requires lazy evaluation as list of tags is dynamically generated using <s:iterator/>Methods inherited from class org.apache.struts2.components.ListUIBeancontains, evaluateExtraParams, getValueClassType, setList, setListCssClass, setListCssStyle, setListKey, setListLabelKey, setListTitle, setListValue, setListValueKey, setThrowExceptionOnNullValueAttributeMethods inherited from class org.apache.struts2.components.UIBeanaddFormParameter, applyValueParameter, buildTemplateName, copyAttributes, enableAncestorFormCustomOnsubmit, end, ensureAttributeSafelyNotEscaped, escape, evaluateNameValue, evaluateParams, getId, getTemplate, getTemplateDir, getTheme, getTooltipConfig, mergeTemplate, populateComponentHtmlId, setAccesskey, setCssClass, setCssErrorClass, setCssErrorStyle, setCssStyle, setDefaultTemplateDir, setDefaultUITheme, setDisabled, setDynamicAttributes, setErrorPosition, setId, setJavascriptTooltip, setKey, setLabel, setLabelPosition, setLabelSeparator, setName, setOnblur, setOnchange, setOnclick, setOndblclick, setOnfocus, setOnkeydown, setOnkeypress, setOnkeyup, setOnmousedown, setOnmousemove, setOnmouseout, setOnmouseover, setOnmouseup, setOnselect, setRequiredLabel, setRequiredPosition, setStaticContentPath, setStyle, setTabindex, setTemplate, setTemplateDir, setTemplateEngineManager, setTheme, setTitle, setTooltip, setTooltipConfig, setTooltipCssClass, setTooltipDelay, setTooltipIconPath, setUIThemeExpansionToken, setValueMethods inherited from class org.apache.struts2.components.ComponentaddAllAttributes, addParameter, completeExpression, determineActionURL, determineNamespace, end, escapeHtmlBody, fieldError, findAncestor, findString, findString, findValue, findValue, findValue, getAttributes, getComponentStack, getNamespace, getPerformClearTagStateForTagPoolingServers, getStack, getStandardAttributes, isAcceptableExpression, isValidTagAttribute, popComponentStack, setActionMapper, setDevMode, setEscapeHtmlBody, setNotExcludedAcceptedPatterns, setPerformClearTagStateForTagPoolingServers, setThrowExceptionsOnELFailure, setUrlHelper, start, stripExpression, toString, usesBody
- 
Field Details- 
TEMPLATE- See Also:
 
 
- 
- 
Constructor Details- 
Radiopublic Radio(ValueStack stack, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) 
 
- 
- 
Method Details- 
getDefaultTemplateDescription copied from class:UIBeanA contract that requires each concrete UI Tag to specify which template should be used as a default. For example, the CheckboxTab might return "checkbox.vm" while the RadioTag might return "radio.vm". This value not begin with a '/' unless you intend to make the path absolute rather than relative to the current theme.- Specified by:
- getDefaultTemplatein class- UIBean
- Returns:
- The name of the template to be used as the default.
 
- 
lazyEvaluationprotected boolean lazyEvaluation()Radio tag requires lazy evaluation as list of tags is dynamically generated using <s:iterator/>- Overrides:
- lazyEvaluationin class- UIBean
- Returns:
- boolean true by default
 
 
-