|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
javax.faces.component Class UIOutput
java.lang.Object javax.faces.component.UIComponent javax.faces.component.UIComponentBase javax.faces.component.UIOutput
- All Implemented Interfaces:
- StateHolder, ValueHolder
- Direct Known Subclasses:
- HtmlOutputFormat, HtmlOutputLabel, HtmlOutputLink, HtmlOutputText, UIInput
public class UIOutput
- extends UIComponentBase
- implements ValueHolder
UIOutput 是包含一个要显示给用户的值的 UIComponent
,可以选择通过值表达式从模型层 Bean 中获取该值。用户无法直接修改呈现的值;它仅用于显示目的。
在请求处理生命周期的呈现响应 阶段,必须根据以下规则,将此组件的当前值转换为 String(如果它还不是 String 的话):
- 如果当前值不为
null
,而且也不是String
,定位用于转换的Converter
(如果有),如下所示: - 如果当前值不是
null
且找到了Converter
,则调用其getAsString()
方法执行转换。 - 如果当前值不是
null
,但未找到Converter
,则调用当前值的toString()
来执行转换。
默认情况下,rendererType
属性必须设置为 "javax.faces.Text
"。可以调用 setRendererType()
方法更改此值。
UIOutput is a UIComponent
that has a
value, optionally retrieved from a model tier bean via a value
expression, that is displayed to the user. The user cannot directly
modify the rendered value; it is for display purposes only.
During the Render Response phase of the request processing lifecycle, the current value of this component must be converted to a String (if it is not already), according to the following rules:
- If the current value is not
null
, and is not already aString
, locate aConverter
(if any) to use for the conversion, as follows: - If the current value is not
null
and aConverter
was located, call itsgetAsString()
method to perform the conversion. - If the current value is not
null
but noConverter
was located, calltoString()
on the current value to perform the conversion.
By default, the rendererType
property must be set to
"javax.faces.Text
". This value can be changed by calling the
setRendererType()
method.
Field Summary | |
---|---|
static String |
COMPONENT_FAMILY
The standard component family for this component. |
static String |
COMPONENT_TYPE
The standard component type for this component. |
Fields inherited from class javax.faces.component.UIComponent |
---|
bindings |
Constructor Summary | |
---|---|
UIOutput()
Create a new UIOutput instance with default property
values. |
Method Summary | |
---|---|
Converter |
getConverter()
Return the Converter (if any)
that is registered for this UIComponent . |
String |
getFamily()
Return the identifier of the component family to which this component belongs. |
Object |
getLocalValue()
Return the local value of this UIComponent (if any),
without evaluating any associated ValueExpression . |
Object |
getValue()
Gets the value of this UIComponent . |
void |
restoreState(FacesContext context,
Object state)
Perform any processing required to restore the state from the entries in the state Object. |
Object |
saveState(FacesContext context)
Gets the state of the instance as a Serializable Object. |
void |
setConverter(Converter converter)
Set the Converter (if any)
that is registered for this UIComponent . |
void |
setValue(Object value)
Set the value of this UIComponent (if any). |
Methods inherited from class javax.faces.component.UIComponent |
---|
encodeAll, getContainerClientId, getValueExpression, setValueExpression |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
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
Constructor Detail |
---|
public
UIOutput()
使用默认属性值创建新的 UIOutput
实例。
UIOutput
public UIOutput()
Create a new
UIOutput
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 appropriateRenderer
for this component instance.- Specified by:
getFamily
in classUIComponent
public Converter
getConverter()
英文文档:
getConverter
public Converter getConverter()
- Description copied from interface:
ValueHolder
Return the
Converter
(if any) that is registered for thisUIComponent
.- Specified by:
getConverter
in interfaceValueHolder
public void
setConverter(Converter converter)
英文文档:
setConverter
public void setConverter(Converter converter)
- Description copied from interface:
ValueHolder
Set the
Converter
(if any) that is registered for thisUIComponent
.- Specified by:
setConverter
in interfaceValueHolder
- Parameters:
converter
- NewConverter
(ornull
)
public Object
getLocalValue()
英文文档:
getLocalValue
public Object getLocalValue()
- Description copied from interface:
ValueHolder
Return the local value of this
UIComponent
(if any), without evaluating any associatedValueExpression
.- Specified by:
getLocalValue
in interfaceValueHolder
public Object
getValue()
英文文档:
getValue
public Object getValue()
- Description copied from interface:
ValueHolder
Gets the value of this
UIComponent
. First, consult the local value property of this component. If non-null
return it. Ifnull
, see if we have aValueExpression
for thevalue
property. If so, return the result of evaluating the property, otherwise returnnull
. Note that because the specification forUIComponent.setValueBinding(java.lang.String, javax.faces.el.ValueBinding)
requires a call through toUIComponent.setValueExpression(java.lang.String, javax.el.ValueExpression)
, legacy tags will continue to work.- Specified by:
getValue
in interfaceValueHolder
public void
setValue(Object value)
英文文档:
setValue
public void setValue(Object value)
- Description copied from interface:
ValueHolder
Set the value of this
UIComponent
(if any).- Specified by:
setValue
in interfaceValueHolder
- Parameters:
value
- The new local value
public Object
saveState(FacesContext context)
英文文档:
saveState
public Object saveState(FacesContext context)
- Description copied from interface:
StateHolder
Gets the state of the instance as a
Serializable
Object.If the class that implements this interface has references to instances that implement StateHolder (such as a
UIComponent
with event handlers, validators, etc.) this method must call theStateHolder.saveState(javax.faces.context.FacesContext)
method on all those instances as well. This method must not save the state of children and facets. That is done via theStateManager
This method must not alter the state of the implementing object. In other words, after executing this code:
Object state = component.saveState(facesContext);
component
should be the same as before executing it.The return from this method must be
Serializable
- Specified by:
saveState
in interfaceStateHolder
- Overrides:
saveState
in classUIComponentBase
public void
restoreState(FacesContext context, Object state)
英文文档:
restoreState
public void restoreState(FacesContext context, Object state)
- Description copied from interface:
StateHolder
Perform any processing required to restore the state from the entries in the state Object.
If the class that implements this interface has references to instances that also implement StateHolder (such as a
UIComponent
with event handlers, validators, etc.) this method must call theStateHolder.restoreState(javax.faces.context.FacesContext, java.lang.Object)
method on all those instances as well.- Specified by:
restoreState
in interfaceStateHolder
- Overrides:
restoreState
in classUIComponentBase
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Submit a bug or feature
Copyright 2007 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.
PS : 未经我党受权你也可自由散发此文档。 如有任何错误请自行修正;若因此而造成任何损失请直接找人民主席,请勿与本人联系。谢谢!