📄 simpletag.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><!--NewPage--><HTML><HEAD><!-- Generated by javadoc (build 1.4.2_02) on Thu Nov 13 17:20:47 PST 2003 --><TITLE>SimpleTag (Java 2 Platform Ent. Ed. v1.4)</TITLE><META NAME="keywords" CONTENT="javax.servlet.jsp.tagext.SimpleTag interface"><LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style"><SCRIPT type="text/javascript">function windowTitle(){ parent.document.title="SimpleTag (Java 2 Platform Ent. Ed. v1.4)";}</SCRIPT></HEAD><BODY BGCOLOR="white" onload="windowTitle();"><!-- ========= START OF TOP NAVBAR ======= --><A NAME="navbar_top"><!-- --></A><A HREF="#skip-navbar_top" title="Skip navigation links"></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""><TR><TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_top_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM><b>Java<sup><font size=-2>TM</font></sup> 2 Platform<br>Ent. Ed. v1.4</b></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../javax/servlet/jsp/tagext/JspTag.html" title="interface in javax.servlet.jsp.tagext"><B>PREV CLASS</B></A> <A HREF="../../../../javax/servlet/jsp/tagext/Tag.html" title="interface in javax.servlet.jsp.tagext"><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> <A HREF="SimpleTag.html" target="_top"><B>NO FRAMES</B></A> <SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--></SCRIPT><NOSCRIPT> <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A></NOSCRIPT></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: NESTED | FIELD | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: FIELD | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><A NAME="skip-navbar_top"></A><!-- ========= END OF TOP NAVBAR ========= --><HR><!-- ======== START OF CLASS DATA ======== --><H2><FONT SIZE="-1">javax.servlet.jsp.tagext</FONT><BR>Interface SimpleTag</H2><DL><DT><B>All Superinterfaces:</B> <DD><A HREF="../../../../javax/servlet/jsp/tagext/JspTag.html" title="interface in javax.servlet.jsp.tagext">JspTag</A></DD></DL><DL><DT><B>All Known Implementing Classes:</B> <DD><A HREF="../../../../javax/servlet/jsp/tagext/SimpleTagSupport.html" title="class in javax.servlet.jsp.tagext">SimpleTagSupport</A></DD></DL><HR><DL><DT>public interface <B>SimpleTag</B><DT>extends <A HREF="../../../../javax/servlet/jsp/tagext/JspTag.html" title="interface in javax.servlet.jsp.tagext">JspTag</A></DL><P>Interface for defining Simple Tag Handlers. <p>Simple Tag Handlers differ from Classic Tag Handlers in that instead of supporting <code>doStartTag()</code> and <code>doEndTag()</code>, the <code>SimpleTag</code> interface provides a simple <code>doTag()</code> method, which is called once and only once for any given tag invocation. All tag logic, iteration, body evaluations, etc. are to be performed in this single method. Thus, simple tag handlers have the equivalent power of <code>BodyTag</code>, but with a much simpler lifecycle and interface.</p> <p>To support body content, the <code>setJspBody()</code> method is provided. The container invokes the <code>setJspBody()</code> method with a <code>JspFragment</code> object encapsulating the body of the tag. The tag handler implementation can call <code>invoke()</code> on that fragment to evaluate the body as many times as it needs.</p> <p>A SimpleTag handler must have a public no-args constructor. Most SimpleTag handlers should extend SimpleTagSupport.</p> <p><b>Lifecycle</b></p> <p>The following is a non-normative, brief overview of the SimpleTag lifecycle. Refer to the JSP Specification for details.</p> <ol> <li>A new tag handler instance is created each time by the container by calling the provided zero-args constructor. Unlike classic tag handlers, simple tag handlers are never cached and reused by the JSP container.</li> <li>The <code>setJspContext()</code> and <code>setParent()</code> methods are called by the container. The <code>setParent()</code> method is only called if the element is nested within another tag invocation.</li> <li>The setters for each attribute defined for this tag are called by the container.</li> <li>If a body exists, the <code>setJspBody()</code> method is called by the container to set the body of this tag, as a <code>JspFragment</code>. If the action element is empty in the page, this method is not called at all.</li> <li>The <code>doTag()</code> method is called by the container. All tag logic, iteration, body evaluations, etc. occur in this method.</li> <li>The <code>doTag()</code> method returns and all variables are synchronized.</li> </ol><P><P><DL><DT><B>Since:</B></DT> <DD>2.0</DD><DT><B>See Also:</B><DD><A HREF="../../../../javax/servlet/jsp/tagext/SimpleTagSupport.html" title="class in javax.servlet.jsp.tagext"><CODE>SimpleTagSupport</CODE></A></DL><HR><P><!-- ======== NESTED CLASS SUMMARY ======== --><!-- =========== FIELD SUMMARY =========== --><!-- ======== CONSTRUCTOR SUMMARY ======== --><!-- ========== METHOD SUMMARY =========== --><A NAME="method_summary"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><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> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../javax/servlet/jsp/tagext/SimpleTag.html#doTag()">doTag</A></B>()</CODE><BR> Called by the container to invoke this tag. </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../../../javax/servlet/jsp/tagext/JspTag.html" title="interface in javax.servlet.jsp.tagext">JspTag</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../../javax/servlet/jsp/tagext/SimpleTag.html#getParent()">getParent</A></B>()</CODE><BR> Returns the parent of this tag, for collaboration purposes.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../javax/servlet/jsp/tagext/SimpleTag.html#setJspBody(javax.servlet.jsp.tagext.JspFragment)">setJspBody</A></B>(<A HREF="../../../../javax/servlet/jsp/tagext/JspFragment.html" title="class in javax.servlet.jsp.tagext">JspFragment</A> jspBody)</CODE><BR> Provides the body of this tag as a JspFragment object, able to be invoked zero or more times by the tag handler. </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../javax/servlet/jsp/tagext/SimpleTag.html#setJspContext(javax.servlet.jsp.JspContext)">setJspContext</A></B>(<A HREF="../../../../javax/servlet/jsp/JspContext.html" title="class in javax.servlet.jsp">JspContext</A> pc)</CODE><BR> Called by the container to provide this tag handler with
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -