ConverterTag (Java EE 5)

Java EE API


javax.faces.webapp Class ConverterTag

java.lang.Object
  extended by javax.servlet.jsp.tagext.TagSupport
      extended by javax.faces.webapp.ConverterTag
All Implemented Interfaces:
Serializable, IterationTag, JspTag, Tag

Deprecated. This has been partially replaced by ConverterELTag. The remainder of the functionality, namely, the binding facility and the implementation of the createConverter() method, is now an implementation detail.

Extends: TagSupport

ConverterTag 是所有满足以下条件的 JSP 自定义操作的基类:对最接近的标记实例(其实现类为 UIComponentTag 的子类)所关联的 ValueHolder 创建并注册一个 Converter 实例。为了避免在重新显示页面时创建重复的实例,仅当执行当前页面期间拥有它的 UIComponentTag 创建相应的 UIComponent 时才创建和注册 Converter

此类必须直接用来实现常规的转换器注册标记(基于 converterId 属性指定的转换器 ID),或者用作支持特定 Converter 子类的标记实例的基类。此 converterId 属性必须引用一个已知的转换器 ID,或 faces-config.xml 文件中定义的自定义转换器 ID。

此类的子类必须实现 createConverter() 方法,该方法创建并返回 Converter 实例。指定此 Converter 行为的任何配置属性必须通过 createConverter() 方法进行了设置。这通常发生在复制标记实例相应的属性值时。

此标记没有对当前创建的页面创建任何输出。它仅用于创建 Converter 时发生的副作用。

英文文档:

public class ConverterTag
extends TagSupport

ConverterTag is a base class for all JSP custom actions that create and register a Converter instance on the ValueHolder associated with our most immediate surrounding instance of a tag whose implementation class is a subclass of UIComponentTag. To avoid creating duplicate instances when a page is redisplayed, creation and registration of a Converter occurs only if the corresponding UIComponent was created (by the owning UIComponentTag) during the execution of the current page.

This class may be used directly to implement a generic converter registration tag (based on the converter-id specified by the converterId attribute), or as a base class for tag instances that support specific Converter subclasses. This converterId attribute must refer to one of the well known converter-ids, or a custom converter-id as defined in a faces-config.xml file.

Subclasses of this class must implement the createConverter() method, which creates and returns a Converter instance. Any configuration properties that specify behavior of this Converter must have been set by the createConverter() method. Generally, this occurs by copying corresponding attribute values on the tag instance.

This tag creates no output to the page currently being created. It is used solely for the side effect of Converter creation.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.servlet.jsp.tagext.TagSupport
 
Fields inherited from interface javax.servlet.jsp.tagext.IterationTag
 
Fields inherited from interface javax.servlet.jsp.tagext.Tag
 
Constructor Summary
 
Method Summary
protected  Converter
 int
 void
 void
 void
 
Methods inherited from class javax.servlet.jsp.tagext.TagSupport
 
Methods inherited from class java.lang.Object
 

Constructor Detail

public ConverterTag()
英文文档:

ConverterTag

public ConverterTag()
Deprecated. 
Method Detail

public void setConverterId(String converterId)

设置要创建的 Converter 实例的标识符。

converterId 要创建的转换器实例的标识符。

英文文档:

setConverterId

public void setConverterId(String converterId)
Deprecated. 

Set the identifer of the Converter instance to be created.

Parameters:
converterId - The identifier of the converter instance to be created.

public void setBinding(String binding) throws JspException

设置将用来创建 ValueExpression(它引用要创建的 Converter 实例的支持 (backing) Bean 属性)的表达式。

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

setBinding

public void setBinding(String binding)
                throws JspException
Deprecated. 

Set the expression that will be used to create a ValueExpression that references a backing bean property of the Converter instance to be created.

Parameters:
binding - The new expression
Throws:
JspException - if a JSP error occurs

public int doStartTag() throws JspException

创建指定 Converter 类的新实例,如果执行包含它的 JSP 页面时创建了 UIComponent 实例,则向最接近的 UIComponentTag 实例所关联的 UIComponent 实例注册该新实例。如果 UIComponent 的 localValue 为 String,可尝试转换它。

ThrowsJspException: 如果发生 JSP 错误
英文文档:

doStartTag

public int doStartTag()
               throws JspException
Deprecated. 

Create a new instance of the specified Converter class, and register it with the UIComponent instance associated with our most immediately surrounding UIComponentTag instance, if the UIComponent instance was created by this execution of the containing JSP page. If the localValue of the UIComponent is a String, attempt to convert it.

Specified by:
doStartTag in interface Tag
Overrides:
doStartTag in class TagSupport
Returns:
SKIP_BODY
Throws:
JspException - if a JSP error occurs
See Also:
Tag.doStartTag()

public void release()

释放对任何所需资源的引用。

英文文档:

release

public void release()
Deprecated. 

Release references to any acquired resources.

Specified by:
release in interface Tag
Overrides:
release in class TagSupport
See Also:
Tag.release()

protected Converter createConverter() throws JspException

创建并返回一个新的 Converter,以向接近的 UIComponent 注册。

ThrowsJspException: 如果无法创建新的实例
英文文档:

createConverter

protected Converter createConverter()
                             throws JspException
Deprecated. 

Create and return a new Converter to be registered on our surrounding UIComponent.

Throws:
JspException - if a new instance cannot be created


Submit a bug or feature

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

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

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