BodyTagSupport (Java EE 5)

Java EE API


javax.servlet.jsp.tagext Class BodyTagSupport

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

public class BodyTagSupport
extends TagSupport
implements BodyTag

Extends: TagSupport
Implements: BodyTag

用来定义实现 BodyTag 的标记处理程序的基类。

BodyTagSupport 类实现 BodyTag 接口并添加了其他便捷方法,包括 bodyContent 属性的 getter 方法和获取以前的 out JspWriter 的方法。

许多标记处理程序将扩展 BodyTagSupport,并且仅重新定义少数几个方法。

英文文档:

A base class for defining tag handlers implementing BodyTag.

The BodyTagSupport class implements the BodyTag interface and adds additional convenience methods including getter methods for the bodyContent property and methods to get at the previous out JspWriter.

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

See Also:
Serialized Form

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

Field Detail

英文文档:

bodyContent

protected BodyContent bodyContent
The current BodyContent for this BodyTag.

Constructor Detail

public BodyTagSupport()
默认构造方法,所有子类只需定义一个具有相同签名的公共构造方法并调用该超类构造方法。 此构造方法通过 JSP 转换器生成的代码调用。
英文文档:

BodyTagSupport

public BodyTagSupport()
Default constructor, all subclasses are required to only define 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.

Method Detail

public int doStartTag() throws JspException
开始标记的默认处理,返回 EVAL_BODY_BUFFERED。
returnEVAL_BODY_BUFFERED
ThrowsJspException: 如果在处理此标记时发生错误
See also doStartTag
英文文档:

doStartTag

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

Specified by:
doStartTag in interface Tag
Overrides:
doStartTag in class TagSupport
Returns:
EVAL_BODY_BUFFERED
Throws:
JspException - if an error occurred while processing this tag
See Also:
Tag.doStartTag()

public int doEndTag() throws JspException
结束标记的默认处理,返回 EVAL_PAGE。
returnEVAL_PAGE
ThrowsJspException: 如果在处理此标记时发生错误
See also doEndTag
英文文档:

doEndTag

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

Specified by:
doEndTag in interface Tag
Overrides:
doEndTag in class TagSupport
Returns:
EVAL_PAGE
Throws:
JspException - if an error occurred while processing this tag
See Also:
Tag.doEndTag()

public void setBodyContent(BodyContent b)
为正文求值做准备:隐藏 bodyContent。
b BodyContent
See also doAfterBody, doInitBody(), setBodyContent
英文文档:

setBodyContent

public void setBodyContent(BodyContent b)
Prepare for evaluation of the body: stash the bodyContent away.

Specified by:
setBodyContent in interface BodyTag
Parameters:
b - the BodyContent
See Also:
doAfterBody(), doInitBody(), BodyTag.setBodyContent(javax.servlet.jsp.tagext.BodyContent)

public void doInitBody() throws JspException
在第一次正文求值之前为正文求值做准备:不执行任何操作。
ThrowsJspException: 如果在处理此标记时发生错误
See also setBodyContent, doAfterBody, doInitBody
英文文档:

doInitBody

public void doInitBody()
                throws JspException
Prepare for evaluation of the body just before the first body evaluation: no action.

Specified by:
doInitBody in interface BodyTag
Throws:
JspException - if an error occurred while processing this tag
See Also:
setBodyContent(javax.servlet.jsp.tagext.BodyContent), doAfterBody(), BodyTag.doInitBody()

public int doAfterBody() throws JspException
在正文求值之后:不重新求值,并继续处理该页面。默认情况下,不使用 bodyContent 数据(如果有)执行任何操作。
returnSKIP_BODY
ThrowsJspException: 如果在处理此标记时发生错误
See also doInitBody, doAfterBody
英文文档:

doAfterBody

public int doAfterBody()
                throws JspException
After the body evaluation: do not reevaluate and continue with the page. By default nothing is done with the bodyContent data (if any).

Specified by:
doAfterBody in interface IterationTag
Overrides:
doAfterBody in class TagSupport
Returns:
SKIP_BODY
Throws:
JspException - if an error occurred while processing this tag
See Also:
doInitBody(), IterationTag.doAfterBody()

public void release()
释放状态。
See also release
英文文档:

release

public void release()
Release state.

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

public BodyContent getBodyContent()
获取当前 bodyContent。
return 正文内容。
英文文档:

getBodyContent

public BodyContent getBodyContent()
Get current bodyContent.

Returns:
the body content.

public JspWriter getPreviousOut()
获取周围的 out JspWriter。
return 封闭的 JspWriter,来自 bodyContent。
英文文档:

getPreviousOut

public JspWriter getPreviousOut()
Get surrounding out JspWriter.

Returns:
the enclosing JspWriter, from the bodyContent.


Submit a bug or feature

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

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

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