UISelectOne (Java EE 5)

Java EE API


javax.faces.component Class UISelectOne

java.lang.Object
  extended by javax.faces.component.UIComponent
      extended by javax.faces.component.UIComponentBase
          extended by javax.faces.component.UIOutput
              extended by javax.faces.component.UIInput
                  extended by javax.faces.component.UISelectOne
All Implemented Interfaces:
EditableValueHolder, StateHolder, ValueHolder
Direct Known Subclasses:
HtmlSelectOneListbox, HtmlSelectOneMenu, HtmlSelectOneRadio

public class UISelectOne
extends UIInput


UISelectOne 是表示用户从离散的可用选项集合中选择 0 或 1 个项的 UIComponent。用户可以修改选定的值。(可选)通过将当前选定项存储为该组件的 value 属性,可以使用它预配置组件。

此组件通常呈现为一个选择框或一组单选按钮。

默认情况下,rendererType 属性被设置为 "javax.faces.Menu"。可以调用 setRendererType() 方法更改此值。

英文文档:

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 "javax.faces.Menu". This value can be changed by calling the setRendererType() method.


Field Summary
static String
static String
static String
 
Fields inherited from class javax.faces.component.UIInput
 
Fields inherited from class javax.faces.component.UIComponent
 
Constructor Summary
 
Method Summary
 String
protected  void
 
Methods inherited from class javax.faces.component.UIInput
 
Methods inherited from class javax.faces.component.UIOutput
 
Methods inherited from class javax.faces.component.UIComponentBase
 
Methods inherited from class javax.faces.component.UIComponent
 
Methods inherited from class java.lang.Object
 
Methods inherited from interface javax.faces.component.ValueHolder
 

Field Detail

英文文档:

COMPONENT_TYPE

public static final String COMPONENT_TYPE

The standard component type for this component.

See Also:
Constant Field Values


英文文档:

COMPONENT_FAMILY

public static final String COMPONENT_FAMILY

The standard component family for this component.

See Also:
Constant Field Values


英文文档:

INVALID_MESSAGE_ID

public static final String INVALID_MESSAGE_ID

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

See Also:
Constant Field Values

Constructor Detail

public UISelectOne()

使用默认属性值创建新的 UISelectOne 实例。

英文文档:

UISelectOne

public UISelectOne()

Create a new UISelectOne instance with default property values.

Method Detail

public String getFamily()
英文文档:

getFamily

public String getFamily()
Description copied from class: UIComponent

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.

Overrides:
getFamily in class UIInput

protected void validateValue(FacesContext context, Object value)

除继承自 UIInput 的标准验证行为外,还确保任何指定的值等于可用选项之一。在比较每个选项前,将根据 Expression 语言强制匹配规则强制匹配选项值类型与此组件值的类型。如果指定的值不等于任何选项,则将错误消息加入队列并将 valid 属性设置为 false

context 当前请求的 FacesContext
value 要测试成员关系的转换值。
ThrowsNullPointerException: 如果 contextnull
英文文档:

validateValue

protected void validateValue(FacesContext context,
                             Object value)

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.

Overrides:
validateValue in class UIInput
Parameters:
context - The FacesContext for the current request
value - The converted value to test for membership.
Throws:
NullPointerException - if context is null


Submit a bug or feature

Copyright 2007 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.

一看就知道只有菜鸟才干这么无知的事啦。

PS : 未经我党受权你也可自由散发此文档。 如有任何错误请自行修正;若因此而造成任何损失请直接找人民主席,请勿与本人联系。谢谢!