bodytag.html

来自「SUN公司官方J2EE中文帮助文档 应该不错 有兴趣的下来看看 html格式的」· HTML 代码 · 共 401 行 · 第 1/2 页

HTML
401
字号
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc on Thu Jan 17 03:51:39 PST 2002 -->
<TITLE>
Java 2 Platform EE v1.3: Interface  BodyTag
</TITLE>
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style">
</HEAD>
<BODY BGCOLOR="white">

<!-- ========== START OF NAVBAR ========== -->
<A NAME="navbar_top"><!-- --></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">
  <TR ALIGN="center" VALIGN="top">
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
  </TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>

<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;PREV CLASS&nbsp;
&nbsp;<A HREF="../../../../javax/servlet/jsp/tagext/IterationTag.html"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
  <A HREF="../../../../index.html" TARGET="_top"><B>FRAMES</B></A>  &nbsp;
&nbsp;<A HREF="BodyTag.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
  SUMMARY: &nbsp;INNER&nbsp;|&nbsp;<A HREF="#field_summary">FIELD</A>&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: &nbsp;<A HREF="#field_detail">FIELD</A>&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<!-- =========== END OF NAVBAR =========== -->

<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
javax.servlet.jsp.tagext</FONT>
<BR>
Interface  BodyTag</H2>
<DL>
<DT><B>All Superinterfaces:</B> <DD><A HREF="../../../../javax/servlet/jsp/tagext/IterationTag.html">IterationTag</A>, <A HREF="../../../../javax/servlet/jsp/tagext/Tag.html">Tag</A></DD>
</DL>
<DL>
<DT><B>All Known Implementing Classes:</B> <DD><A HREF="../../../../javax/servlet/jsp/tagext/BodyTagSupport.html">BodyTagSupport</A></DD>
</DL>
<HR>
<DL>
<DT>public interface <B>BodyTag</B><DT>extends <A HREF="../../../../javax/servlet/jsp/tagext/IterationTag.html">IterationTag</A></DL>

<P>
The BodyTag interface extends IterationTag by defining additional
 methods that let a tag handler manipulate the content of evaluating its body.

 <p>
 It is the responsibility of the tag handler to manipulate the body
 content.  For example the tag handler may take the body content,
 convert it into a String using the bodyContent.getString
 method and then use it.  Or the tag handler may take the body
 content and write it out into its enclosing JspWriter using
 the bodyContent.writeOut method.

 <p> A tag handler that implements BodyTag is treated as one that
 implements IterationTag, except that the doStartTag method can
 return SKIP_BODY, EVAL_BODY_INCLUDE or EVAL_BODY_BUFFERED.

 <p>
 If EVAL_BODY_INCLUDE is returned, then evaluation happens
 as in IterationTag.

 <p>
 If EVAL_BODY_BUFFERED is returned, then a BodyContent object will be
 created (by code generated by the JSP compiler) to capture the body
 evaluation.
 The code generated by the JSP compiler obtains the BodyContent object by
 calling the pushBody method of the current pageContext, which
 additionally has the effect of saving the previous out value.
 The page compiler returns this object by calling the popBody
 method of the PageContext class;
 the call also restores the value of out.

 <p>
 The interface provides one new property with a setter method and one
 new action method.

 <p><B>Properties</B>
 <p> There is a new property: bodyContent, to contain the BodyContent
 object, where the JSP Page implementation object will place the
 evaluation (and reevaluation, if appropriate) of the body.  The setter
 method (setBodyContent) will only be invoked if doStartTag() returns
 EVAL_BODY_BUFFERED.

 <p><B>Methods</B>
 <p> In addition to the setter method for the bodyContent property, there
 is a new action methods: doInitBody(), which is invoked right after
 setBodyContent() and before the body evaluation.  This method is only
 invoked if doStartTag() returns EVAL_BODY_BUFFERED.

 <p><B>Lifecycle</B>
 <p> Lifecycle details are described by the transition diagram below.
 Exceptions that are thrown during the computation of doStartTag(),
 setBodyContent(), doInitBody(), BODY, doAfterBody() interrupt the
 execution sequence and are propagated up the stack, unless the
 tag handler implements the TryCatchFinally interface; see that
 interface for details.
 <p>
 <IMG src="doc-files/BodyTagProtocol.gif"/>

 <p><B>Empty and Non-Empty Action</B>
 <p> If the TagLibraryDescriptor file indicates that the action must
 always have an empty action, by an &lt;body-content&gt; entry of "empty",
 then the doStartTag() method must return SKIP_BODY.

 Otherwise, the doStartTag() method may return SKIP_BODY,
 EVAL_BODY_INCLUDE, or EVAL_BODY_BUFFERED.

 <p>
 If SKIP_BODY is returned the body is not evaluated, and doEndTag() is
 invoked.

 <p>
 If EVAL_BODY_INCLUDE is returned, setBodyContent() is not invoked,
 doInitBody() is not invoked, the body is evaluated and
 "passed through" to the current out, doAfterBody() is invoked
 and then, after zero or more iterations, doEndTag() is invoked.

 <p>
 If EVAL_BODY_BUFFERED is returned, setBodyContent() is invoked,
 doInitBody() is invoked, the body is evaluated, doAfterBody() is
 invoked, and then, after zero or more iterations, doEndTag() is invoked.
<P>
<HR>

<P>
<!-- ======== INNER CLASS SUMMARY ======== -->


<!-- =========== FIELD SUMMARY =========== -->

<A NAME="field_summary"><!-- --></A>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
<B>Field Summary</B></FONT></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../javax/servlet/jsp/tagext/BodyTag.html#EVAL_BODY_BUFFERED">EVAL_BODY_BUFFERED</A></B></CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Request the creation of new buffer, a BodyContent on which to
 evaluate the body of this tag.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../javax/servlet/jsp/tagext/BodyTag.html#EVAL_BODY_TAG">EVAL_BODY_TAG</A></B></CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>Deprecated.</B>&nbsp;<I>As of Java JSP API 1.2, use BodyTag.EVAL_BODY_BUFFERED
 or IterationTag.EVAL_BODY_AGAIN.</I></TD>
</TR>
</TABLE>
&nbsp;<A NAME="fields_inherited_from_class_javax.servlet.jsp.tagext.IterationTag"><!-- --></A>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TD><B>Fields inherited from interface javax.servlet.jsp.tagext.<A HREF="../../../../javax/servlet/jsp/tagext/IterationTag.html">IterationTag</A></B></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="../../../../javax/servlet/jsp/tagext/IterationTag.html#EVAL_BODY_AGAIN">EVAL_BODY_AGAIN</A></CODE></TD>
</TR>
</TABLE>
&nbsp;<A NAME="fields_inherited_from_class_javax.servlet.jsp.tagext.Tag"><!-- --></A>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TD><B>Fields inherited from interface javax.servlet.jsp.tagext.<A HREF="../../../../javax/servlet/jsp/tagext/Tag.html">Tag</A></B></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="../../../../javax/servlet/jsp/tagext/Tag.html#EVAL_BODY_INCLUDE">EVAL_BODY_INCLUDE</A>, <A HREF="../../../../javax/servlet/jsp/tagext/Tag.html#EVAL_PAGE">EVAL_PAGE</A>, <A HREF="../../../../javax/servlet/jsp/tagext/Tag.html#SKIP_BODY">SKIP_BODY</A>, <A HREF="../../../../javax/servlet/jsp/tagext/Tag.html#SKIP_PAGE">SKIP_PAGE</A></CODE></TD>
</TR>
</TABLE>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?