TagSupport (Java EE 5 SDK)

Java

Java EE 5 SDK

深圳电信培训中心.徐海蛟老师.


javax.servlet.jsp.tagext Class TagSupport

java.lang.Object
  extended by javax.servlet.jsp.tagext.TagSupport
所有已实现的接口:
Serializable, IterationTag, JspTag, Tag
直接已知子类:
AttributeTag, BodyTagSupport, ConverterELTag, ConverterTag, FacetTag, ValidatorELTag, ValidatorTag

public class TagSupport
extends Object
implements IterationTag, Serializable

A base class for defining new tag handlers implementing Tag.

The TagSupport class is a utility class intended to be used as the base class for new tag handlers. The TagSupport class implements the Tag and IterationTag interfaces and adds additional convenience methods including getter methods for the properties in Tag. TagSupport has one static method that is included to facilitate coordination among cooperating tags.

Many tag handlers will extend TagSupport and only redefine a few methods.

另请参见:
Serialized Form

字段摘要
protected  String id
          The value of the id attribute of this tag; or null.
protected  PageContext pageContext
          The PageContext.
 
Fields inherited from interface javax.servlet.jsp.tagext.IterationTag
EVAL_BODY_AGAIN
 
Fields inherited from interface javax.servlet.jsp.tagext.Tag
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE
 
构造器摘要
TagSupport()
          Default constructor, all subclasses are required to define only a public constructor with the same signature, and to call the superclass constructor.
 
方法摘要
 int doAfterBody()
          Default processing for a body.
 int doEndTag()
          Default processing of the end tag returning EVAL_PAGE.
 int doStartTag()
          Default processing of the start tag, returning SKIP_BODY.
static Tag findAncestorWithClass(Tag from, Class klass)
          Find the instance of a given class type that is closest to a given instance.
 String getId()
          The value of the id attribute of this tag; or null.
 Tag getParent()
          The Tag instance most closely enclosing this tag instance.
 Object getValue(String k)
          Get a the value associated with a key.
 Enumeration<String> getValues()
          Enumerate the keys for the values kept by this tag handler.
 void release()
          Release state.
 void removeValue(String k)
          Remove a value associated with a key.
 void setId(String id)
          Set the id attribute for this tag.
 void setPageContext(PageContext pageContext)
          Set the page context.
 void setParent(Tag t)
          Set the nesting tag of this tag.
 void setValue(String k, Object o)
          Associate a value with a String key.
 
类方法继承 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

字段详细信息

id

protected String id
The value of the id attribute of this tag; or null.


pageContext

protected PageContext pageContext
The PageContext.

构造器详细信息

TagSupport

public TagSupport()
Default constructor, all subclasses are required to define only a public constructor with the same signature, and to call the superclass constructor. This constructor is called by the code generated by the JSP translator.

方法详细信息

findAncestorWithClass

public static final Tag findAncestorWithClass(Tag from,
                                              Class klass)
Find the instance of a given class type that is closest to a given instance. This method uses the getParent method from the Tag interface. This method is used for coordination among cooperating tags.

The current version of the specification only provides one formal way of indicating the observable type of a tag handler: its tag handler implementation class, described in the tag-class subelement of the tag element. This is extended in an informal manner by allowing the tag library author to indicate in the description subelement an observable type. The type should be a subtype of the tag handler implementation class or void. This addititional constraint can be exploited by a specialized container that knows about that specific tag library, as in the case of the JSP standard tag library.

When a tag library author provides information on the observable type of a tag handler, client programmatic code should adhere to that constraint. Specifically, the Class passed to findAncestorWithClass should be a subtype of the observable type.

参数:
from - The instance from where to start looking.
klass - The subclass of Tag or interface to be matched
返回:
the nearest ancestor that implements the interface or is an instance of the class specified

doStartTag

public int doStartTag()
               throws JspException
Default processing of the start tag, returning SKIP_BODY.

规范说明:
doStartTag in interface Tag
返回:
SKIP_BODY
抛出异常:
JspException - if an error occurs while processing this tag
另请参见:
Tag.doStartTag()

doEndTag

public int doEndTag()
             throws JspException
Default processing of the end tag returning EVAL_PAGE.

规范说明:
doEndTag in interface Tag
返回:
EVAL_PAGE
抛出异常:
JspException - if an error occurs while processing this tag
另请参见:
Tag.doEndTag()

doAfterBody

public int doAfterBody()
                throws JspException
Default processing for a body.

规范说明:
doAfterBody in interface IterationTag
返回:
SKIP_BODY
抛出异常:
JspException - if an error occurs while processing this tag
另请参见:
IterationTag.doAfterBody()

release

public void release()
Release state.

规范说明:
release in interface Tag
另请参见:
Tag.release()

setParent

public void setParent(Tag t)
Set the nesting tag of this tag.

规范说明:
setParent in interface Tag
参数:
t - The parent Tag.
另请参见:
Tag.setParent(Tag)

getParent

public Tag getParent()
The Tag instance most closely enclosing this tag instance.

规范说明:
getParent in interface Tag
返回:
the parent tag instance or null
另请参见:
Tag.getParent()

setId

public void setId(String id)
Set the id attribute for this tag.

参数:
id - The String for the id.

getId

public String getId()
The value of the id attribute of this tag; or null.

返回:
the value of the id attribute, or null

setPageContext

public void setPageContext(PageContext pageContext)
Set the page context.

规范说明:
setPageContext in interface Tag
参数:
pageContext - The PageContext.
另请参见:
Tag.setPageContext(javax.servlet.jsp.PageContext)

setValue

public void setValue(String k,
                     Object o)
Associate a value with a String key.

参数:
k - The key String.
o - The value to associate.

getValue

public Object getValue(String k)
Get a the value associated with a key.

参数:
k - The string key.
返回:
The value associated with the key, or null.

removeValue

public void removeValue(String k)
Remove a value associated with a key.

参数:
k - The string key.

getValues

public Enumeration<String> getValues()
Enumerate the keys for the values kept by this tag handler.

返回:
An enumeration of all the keys for the values set, or null or an empty Enumeration if no values have been set.

Java EE 5 SDK

深圳电信培训中心.徐海蛟老师.


提交错误或意见

版权所有 2007 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。深圳电信培训中心.徐海蛟老师教学参考.