tag.html

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

HTML
488
字号
<!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  Tag
</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;<A HREF="../../../../javax/servlet/jsp/tagext/IterationTag.html"><B>PREV CLASS</B></A>&nbsp;
&nbsp;<A HREF="../../../../javax/servlet/jsp/tagext/TryCatchFinally.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="Tag.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  Tag</H2>
<DL>
<DT><B>All Known Subinterfaces:</B> <DD><A HREF="../../../../javax/servlet/jsp/tagext/BodyTag.html">BodyTag</A>, <A HREF="../../../../javax/servlet/jsp/tagext/IterationTag.html">IterationTag</A></DD>
</DL>
<HR>
<DL>
<DT>public interface <B>Tag</B></DL>

<P>
The interface of a simple tag handler that does not want to manipulate its body.
 The Tag interface defines the basic protocol between a Tag handler and
 JSP page implementation class.  It defines the life cycle and the
 methods to be invoked at start and end tag.

 <p><B>Properties</B>

 <p>
 The  Tag interface specifies the setter and getter methods for the core
 pageContext and parent properties.

 <p> The JSP page implementation object invokes setPageContext and
 setParent, in that order, before invoking doStartTag() or doEndTag().

 <p><B>Methods</B>

 <p>
 There are two main actions: doStartTag and doEndTag.  Once all
 appropriate properties have been initialized, the doStartTag and
 doEndTag methods can be invoked on the tag handler.  Between these
 invocations, the tag handler is assumed to hold a state that must
 be preserved.  After the doEndTag invocation, the tag handler is
 available for further invocations (and it is expected to have
 retained its properties).

 <p><B>Lifecycle</B>
 <p> Lifecycle details are described by the transition diagram below,
 with the following comments:
 <ul>
 <li> [1] This transition is intended to be for releasing long-term data.
 no guarantees are assumed on whether any properties have been retained
 or not.
 <li> [2] This transition happens if and only if the tag ends normally
 without raising an exception
 <li> [3] Note that since there are no guarantees on the state of the
 properties, a tag handler that had some optional properties set can only be
 reused if those properties are set to a new (known) value.  This means
 that tag handlers can only be reused within the same "AttSet" (set of
 attributes that have been set).
 <li> Check the TryCatchFinally interface for additional details related
 to exception handling and resource management.
 </ul>

 <IMG src="doc-files/TagProtocol.gif"/>
 
 <p> Once all invocations on the tag handler
 are completed, the release method is invoked on it.  Once a release
 method is invoked <em>all</em> properties, including parent and
 pageContext, are assumed to have been reset to an unspecified value.
 The page compiler guarantees that release() will be invoked on the Tag
 handler before the handler is released to the GC.

 <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 or
 EVAL_BODY_INCLUDE.

 <p>
 If SKIP_BODY is returned the body, if present, is not evaluated.
 
 <p>
 If EVAL_BODY_INCLUDE is returned, the body is evaluated and
 "passed through" to the current out.
<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/Tag.html#EVAL_BODY_INCLUDE">EVAL_BODY_INCLUDE</A></B></CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Evaluate body into existing out stream.</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/Tag.html#EVAL_PAGE">EVAL_PAGE</A></B></CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Continue evaluating the page.</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/Tag.html#SKIP_BODY">SKIP_BODY</A></B></CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Skip body evaluation.</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/Tag.html#SKIP_PAGE">SKIP_PAGE</A></B></CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Skip the rest of the page.</TD>
</TR>
</TABLE>
&nbsp;
<!-- ======== CONSTRUCTOR SUMMARY ======== -->


<!-- ========== METHOD SUMMARY =========== -->

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

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Process the end tag for this instance.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../javax/servlet/jsp/tagext/Tag.html#doStartTag()">doStartTag</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Process the start tag for this instance.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="../../../../javax/servlet/jsp/tagext/Tag.html">Tag</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../javax/servlet/jsp/tagext/Tag.html#getParent()">getParent</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Get the parent (closest enclosing tag handler) for this tag handler.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../javax/servlet/jsp/tagext/Tag.html#release()">release</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Called on a Tag handler to release state.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../javax/servlet/jsp/tagext/Tag.html#setPageContext(javax.servlet.jsp.PageContext)">setPageContext</A></B>(<A HREF="../../../../javax/servlet/jsp/PageContext.html">PageContext</A>&nbsp;pc)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Set the current page context.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../javax/servlet/jsp/tagext/Tag.html#setParent(javax.servlet.jsp.tagext.Tag)">setParent</A></B>(<A HREF="../../../../javax/servlet/jsp/tagext/Tag.html">Tag</A>&nbsp;t)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Set the parent (closest enclosing tag handler) of this tag handler.</TD>
</TR>
</TABLE>
&nbsp;
<P>

⌨️ 快捷键说明

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