UIComponentELTag (Java EE 5)

Java EE API


javax.faces.webapp Class UIComponentELTag

java.lang.Object
  extended by javax.faces.webapp.UIComponentTagBase
      extended by javax.faces.webapp.UIComponentClassicTagBase
          extended by javax.faces.webapp.UIComponentELTag
All Implemented Interfaces:
BodyTag, IterationTag, JspIdConsumer, JspTag, Tag

public abstract class UIComponentELTag
extends UIComponentClassicTagBase
implements Tag

Implements: Tag

UIComponentELTag 使其超类专门化,以允许属性从 EL API 表达式中获取值。

此标记设计用于 Faces 1.2 版本和 JSP 2.1 版本的容器。

英文文档:

UIComponentELTag specializes its superclass to allow for properties that take their values from EL API expressions.

This tag is designed for use with Faces version 1.2 and JSP version 2.1 containers.


Field Summary
 
Fields inherited from class javax.faces.webapp.UIComponentClassicTagBase
 
Fields inherited from class javax.faces.webapp.UIComponentTagBase
 
Fields inherited from interface javax.servlet.jsp.tagext.Tag
 
Fields inherited from interface javax.servlet.jsp.tagext.BodyTag
 
Fields inherited from interface javax.servlet.jsp.tagext.IterationTag
 
Constructor Summary
 
Method Summary
protected  UIComponent
protected  ELContext
protected  boolean
 void
 void
protected  void
 void
 
Methods inherited from class javax.faces.webapp.UIComponentClassicTagBase
 
Methods inherited from class javax.faces.webapp.UIComponentTagBase
 
Methods inherited from class java.lang.Object
 
Methods inherited from interface javax.servlet.jsp.tagext.Tag
 

Constructor Detail

public UIComponentELTag()
英文文档:

UIComponentELTag

public UIComponentELTag()
Method Detail

public void setBinding(ValueExpression binding) throws JspException

设置组件的值表达式。

binding 新的值表达式
ThrowsJspException: 如果发生错误
英文文档:

setBinding

public void setBinding(ValueExpression binding)
                throws JspException

Set the value expression for our component.

Parameters:
binding - The new value expression
Throws:
JspException - if an error occurs

protected boolean hasBinding()
英文文档:

hasBinding

protected boolean hasBinding()
Description copied from class: UIComponentClassicTagBase

Return true if this component has a non-null binding attribute. This method is necessary to allow subclasses that expose the binding property as an Faces 1.1 style EL property as well as subclasses that expose it as an EL API property.

Specified by:
hasBinding in class UIComponentClassicTagBase

public void setRendered(ValueExpression rendered)

为呈现的属性设置重写。

rendered 呈现属性的新值
英文文档:

setRendered

public void setRendered(ValueExpression rendered)

Set an override for the rendered attribute.

Parameters:
rendered - The new value for rendered attribute

protected ELContext getELContext()

返回此请求的 FacesContextELContext

这是 getFacesContext().getELContext() 的便捷方法。

英文文档:

getELContext

protected ELContext getELContext()

Return the ELContext for the FacesContext for this request.

This is a convenience for getFacesContext().getELContext().

Overrides:
getELContext in class UIComponentTagBase

public void release()

释放执行此标记处理程序期间分配的所有资源。

英文文档:

release

public void release()

Release any resources allocated during the execution of this tag handler.

Specified by:
release in interface Tag
Overrides:
release in class UIComponentClassicTagBase

protected void setProperties(UIComponent component)

如果明确设置了此标记处理程序实例相应的属性,则重写指定组件的属性。仅当指定的 UIComponent 在执行此标记处理器实例期间实际创建时,才调用此方法,此调用将在向视图添加 UIComponent 之前发生。

希望支持其他设置属性的标记子类必须确保仍然调用了基类 setProperties() 方法。支持额外属性 foobar 的典型实现如下所示:

protected void setProperties(UIComponent component) {
super.setProperties(component);
if (foo != null) {
component.setAttribute("foo", foo);
   }
if (bar != null) {
component.setAttribute("bar", bar);
   }
 }
 

默认实现重写以下属性:

  • rendered - 为此标记处理程序实例指定了 rendered 属性的值时设置。
  • rendererType - getRendererType() 方法返回非 null 值时设置。
component 要重写属性的 UIComponent
英文文档:

setProperties

protected void setProperties(UIComponent component)

Override properties and attributes of the specified component, if the corresponding properties of this tag handler instance were explicitly set. This method must be called ONLY if the specified UIComponent was in fact created during the execution of this tag handler instance, and this call will occur BEFORE the UIComponent is added to the view.

Tag subclasses that want to support additional set properties must ensure that the base class setProperties() method is still called. A typical implementation that supports extra properties foo and bar would look something like this:

 protected void setProperties(UIComponent component) {
   super.setProperties(component);
   if (foo != null) {
     component.setAttribute("foo", foo);
   }
   if (bar != null) {
     component.setAttribute("bar", bar);
   }
 }
 

The default implementation overrides the following properties:

  • rendered - Set if a value for the rendered property is specified for this tag handler instance.
  • rendererType - Set if the getRendererType() method returns a non-null value.

Specified by:
setProperties in class UIComponentClassicTagBase
Parameters:
component - UIComponent whose properties are to be overridden

protected UIComponent createComponent(FacesContext context, String newId) throws JspException

创建并返回新的类型(通过调用 getComponentType() 返回)子组件。如果此 UIComponentELTag 拥有非 null 的 binding 属性,则使用为 binding 属性创建的 ValueExpression 调用 Application#createComponent 实现,该 ValueExpression 将被存储在组件中。否则,调用 Application#createComponent,只有组件类型参数。最后,初始化组件 ID 和其他属性。

context 当前请求的 FacesContext
newId 组件的 ID
英文文档:

createComponent

protected UIComponent createComponent(FacesContext context,
                                      String newId)
                               throws JspException

Create and return a new child component of the type returned by calling getComponentType(). If this UIComponentELTag has a non-null binding attribute, this is done by call Application.createComponent(java.lang.String) with the ValueExpression created for the binding attribute, and the ValueExpression will be stored on the component. Otherwise, Application.createComponent(java.lang.String) is called with only the component type. Finally, initialize the components id and other properties.

Specified by:
createComponent in class UIComponentClassicTagBase
Parameters:
context - FacesContext for the current request
newId - id of the component
Throws:
JspException


Submit a bug or feature

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

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

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