Top Description Inners Fields Constructors Methods
jakarta.faces.component

public Class UISelectOne

extends UIInput
Class Inheritance
Known Direct Subclasses
jakarta.faces.component.html.HtmlSelectOneListbox, jakarta.faces.component.html.HtmlSelectOneMenu, jakarta.faces.component.html.HtmlSelectOneRadio
Imports
jakarta.faces.application.FacesMessage, jakarta.faces.component.visit.VisitContext, .VisitResult, jakarta.faces.context.FacesContext

UISelectOne is a UIComponent that represents the user's choice of zero or one items from among a discrete set of available options. The user can modify the selected value. Optionally, the component can be preconfigured with a currently selected item, by storing it as the value property of the component.

This component is generally rendered as a select box or a group of radio buttons.

By default, the rendererType property is set to "jakarta.faces.Menu". This value can be changed by calling the setRendererType() method.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static enum

Field Summary

Modifier and TypeField and Description
public static final String
COMPONENT_FAMILY

Hides jakarta.faces.component.UIInput.COMPONENT_FAMILY.

The standard component family for this component.

public static final String
COMPONENT_TYPE

Hides jakarta.faces.component.UIInput.COMPONENT_TYPE.

The standard component type for this component.

public static final String
INVALID_MESSAGE_ID

The message identifier of the jakarta.faces.application.FacesMessage to be created if a value not matching the available options is specified.

Inherited from jakarta.faces.component.UIInput:
ALWAYS_PERFORM_VALIDATION_WHEN_REQUIRED_IS_TRUECONVERSION_MESSAGE_IDEMPTY_STRING_AS_NULL_PARAM_NAMEREQUIRED_MESSAGE_IDUPDATE_MESSAGE_IDVALIDATE_EMPTY_FIELDS_PARAM_NAMEvalidators

Constructor Summary

AccessConstructor and Description
public
UISelectOne()

Create a new UISelectOne instance with default property values.

Method Summary

Modifier and TypeMethod and Description
public String
getFamily()

Overrides jakarta.faces.component.UIInput.getFamily.

Return the identifier of the component family to which this component belongs.

public String

Returns:

The name of the radio button group.
getGroup
()

Returns the name of the radio button group.

private static UIComponent
private static boolean
private static boolean
public void
processValidators(FacesContext
FacesContext for the request we are processing
context
)

Overrides jakarta.faces.component.UIInput.processValidators.

If getGroup() is set, and getSubmittedValue() is empty, and at least one other component having the same group within a UIForm parent has a non-empty getSubmittedValue() or returns true on isLocalValueSet() or returns false on isValid(), then skip validation for current component, else perform standard superclass processing by super.processValidators(context).

public void
setGroup(String
The name of the radio button group.
group
)

Sets the name of the radio button group.

protected void
validateValue(FacesContext
The FacesContext for the current request
context
,
Object
The converted value to test for membership.
value
)

Overrides jakarta.faces.component.UIInput.validateValue.

In addition to the standard validation behavior inherited from UIInput, ensure that any specified value is equal to one of the available options.

Inherited from jakarta.faces.component.UIInput:
addValidatoraddValueChangeListenerclearInitialStatecompareValuesconsiderEmptyStringNulldecodegetConvertedValuegetConverterMessagegetRequiredMessagegetSubmittedValuegetValidatorMessagegetValidatorsgetValuegetValueChangeListenersisEmptyisImmediateisLocalValueSetisRequiredisValidmarkInitialStateprocessDecodesprocessUpdatesremoveValidatorremoveValueChangeListenerresetValuerestoreStatesaveStatesetConverterMessagesetImmediatesetLocalValueSetsetRequiredsetRequiredMessagesetSubmittedValuesetValidsetValidatorMessagesetValueupdateModelvalidate

Field Detail

COMPONENT_FAMILYback to summary
public static final String COMPONENT_FAMILY

Hides jakarta.faces.component.UIInput.COMPONENT_FAMILY.

The standard component family for this component.

COMPONENT_TYPEback to summary
public static final String COMPONENT_TYPE

Hides jakarta.faces.component.UIInput.COMPONENT_TYPE.

The standard component type for this component.

INVALID_MESSAGE_IDback to summary
public static final String INVALID_MESSAGE_ID

The message identifier of the jakarta.faces.application.FacesMessage to be created if a value not matching the available options is specified.

Constructor Detail

UISelectOneback to summary
public UISelectOne()

Create a new UISelectOne instance with default property values.

Method Detail

getFamilyback to summary
public String getFamily()

Overrides jakarta.faces.component.UIInput.getFamily.

Doc from jakarta.faces.component.UIComponent.getFamily.

Return the identifier of the component family to which this component belongs. This identifier, in conjunction with the value of the rendererType property, may be used to select the appropriate Renderer for this component instance. Note this method should NOT return null

Returns:String

the component family (not null).

Annotations
@Override
getGroupback to summary
public String getGroup()

Returns the name of the radio button group.

Radio button components having the same group within a UIForm parent will uncheck all others when being checked. If the value attribute is absent then the one from first component of the group will be used. If the UISelectItem child is absent then the one from first component of the group will be used.

Returns:String

The name of the radio button group.

Since
2.3
getGroupContainerback to summary
private static UIComponent getGroupContainer(FacesContext context, UISelectOne radio)
isAlreadySubmittedOrValidatedback to summary
private static boolean isAlreadySubmittedOrValidated(EditableValueHolder input)
isOtherMemberOfSameGroupback to summary
private static boolean isOtherMemberOfSameGroup(FacesContext context, String group, String clientId, UISelectOne radio)
processValidatorsback to summary
public void processValidators(FacesContext context)

Overrides jakarta.faces.component.UIInput.processValidators.

If getGroup() is set, and getSubmittedValue() is empty, and at least one other component having the same group within a UIForm parent has a non-empty getSubmittedValue() or returns true on isLocalValueSet() or returns false on isValid(), then skip validation for current component, else perform standard superclass processing by super.processValidators(context).

Parameters
context:FacesContext

Doc from jakarta.faces.component.UIComponent.processValidators.

FacesContext for the request we are processing

Annotations
@Override
setGroupback to summary
public void setGroup(String group)

Sets the name of the radio button group.

Parameters
group:String

The name of the radio button group.

Since
2.3
validateValueback to summary
protected void validateValue(FacesContext context, Object value)

Overrides jakarta.faces.component.UIInput.validateValue.

In addition to the standard validation behavior inherited from UIInput, ensure that any specified value is equal to one of the available options. Before comparing each option, coerce the option value type to the type of this component's value following the Expression Language coercion rules. If the specified value is not equal to any of the options, enqueue an error message and set the valid property to false.

If isRequired returns true, and the current value is equal to the value of an inner UISelectItem whose UISelectItem#isNoSelectionOption method returns true, enqueue an error message and set the valid property to false.

Parameters
context:FacesContext

The FacesContext for the current request

value:Object

The converted value to test for membership.

Annotations
@Override
Exceptions
NullPointerException:
if context is null
jakarta.faces.component back to summary

pack-priv final Enum UISelectOne.PropertyKeys

extends Enum<UISelectOne.PropertyKeys>
Class Inheritance

Field Summary

Modifier and TypeField and Description
public static final UISelectOne.PropertyKeys
group

Specifies the name of the radio button group.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static UISelectOne.PropertyKeys
public static UISelectOne.PropertyKeys[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

groupback to summary
public static final UISelectOne.PropertyKeys group

Specifies the name of the radio button group.

Since
2.3

Constructor Detail

PropertyKeysback to summary
private PropertyKeys()

Method Detail

valueOfback to summary
public static UISelectOne.PropertyKeys valueOf(String name)
valuesback to summary
public static UISelectOne.PropertyKeys[] values()