`
glacier3
  • 浏览: 385102 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论

Interface Tag

阅读更多
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style"><!---->

javax.servlet.jsp.tagext
Interface Tag

All Known Subinterfaces:
BodyTag, IterationTag

public interface Tag

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.

Properties

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

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

Methods

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).

Lifecycle

Lifecycle details are described by the transition diagram below, with the following comments:

  • [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.
  • [2] This transition happens if and only if the tag ends normally without raising an exception
  • [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).
  • Check the TryCatchFinally interface for additional details related to exception handling and resource management.

Once all invocations on the tag handler are completed, the release method is invoked on it. Once a release method is invoked all 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.

Empty and Non-Empty Action

If the TagLibraryDescriptor file indicates that the action must always have an empty action, by an <body-content> entry of "empty", then the doStartTag() method must return SKIP_BODY. Otherwise, the doStartTag() method may return SKIP_BODY or EVAL_BODY_INCLUDE.

If SKIP_BODY is returned the body, if present, is not evaluated.

If EVAL_BODY_INCLUDE is returned, the body is evaluated and "passed through" to the current out.


<!----><!----><!---->

Field Summary
static int EVAL_BODY_INCLUDE
          Evaluate body into existing out stream.
static int EVAL_PAGE
          Continue evaluating the page.
static int SKIP_BODY
          Skip body evaluation.
static int SKIP_PAGE
          Skip the rest of the page.
  <!---->
Method Summary
 int doEndTag()
          Process the end tag for this instance.
 int doStartTag()
          Process the start tag for this instance.
 Tag getParent()
          Get the parent (closest enclosing tag handler) for this tag handler.
 void release()
          Called on a Tag handler to release state.
 void setPageContext(PageContext pc)
          Set the current page context.
 void setParent(Tag t)
          Set the parent (closest enclosing tag handler) of this tag handler.
 

<!----><!---->

Field Detail
<!---->

SKIP_BODY

public static final int SKIP_BODY
Skip body evaluation. Valid return value for doStartTag and doAfterBody.

<!---->

EVAL_BODY_INCLUDE

public static final int EVAL_BODY_INCLUDE
Evaluate body into existing out stream. Valid return value for doStartTag.

<!---->

SKIP_PAGE

public static final int SKIP_PAGE
Skip the rest of the page. Valid return value for doEndTag.

<!---->

EVAL_PAGE

public static final int EVAL_PAGE
Continue evaluating the page. Valid return value for doEndTag().
<!---->
Method Detail
<!---->

setPageContext

public void setPageContext(PageContext pc)
Set the current page context. This method is invoked by the JSP page implementation object prior to doStartTag().

This value is *not* reset by doEndTag() and must be explicitly reset by a page implementation if it changes between calls to doStartTag().

Parameters:
pc - The page context for this tag handler.

<!---->

setParent

public void setParent(Tag t)
Set the parent (closest enclosing tag handler) of this tag handler. Invoked by the JSP page implementation object prior to doStartTag().

This value is *not* reset by doEndTag() and must be explicitly reset by a page implementation.

Parameters:
t - The parent tag, or null.

<!---->

getParent

public Tag getParent()
Get the parent (closest enclosing tag handler) for this tag handler.

The getParent() method can be used to navigate the nested tag handler structure at runtime for cooperation among custom actions; for example, the findAncestorWithClass() method in TagSupport provides a convenient way of doing this.

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.


<!---->

doStartTag

public int doStartTag()                throws JspException
Process the start tag for this instance. This method is invoked by the JSP page implementation object.

The doStartTag method assumes that the properties pageContext and parent have been set. It also assumes that any properties exposed as attributes have been set too. When this method is invoked, the body has not yet been evaluated.

This method returns Tag.EVAL_BODY_INCLUDE or BodyTag.EVAL_BODY_BUFFERED to indicate that the body of the action should be evaluated or SKIP_BODY to indicate otherwise.

When a Tag returns EVAL_BODY_INCLUDE the result of evaluating the body (if any) is included into the current "out" JspWriter as it happens and then doEndTag() is invoked.

BodyTag.EVAL_BODY_BUFFERED is only valid if the tag handler implements BodyTag.

The JSP container will resynchronize any variable values that are indicated as so in TagExtraInfo after the invocation of doStartTag().

Throws:
JspException. -  
See Also:
BodyTag

<!---->

doEndTag

public int doEndTag()              throws JspException
Process the end tag for this instance. This method is invoked by the JSP page implementation object on all Tag handlers.

This method will be called after returning from doStartTag. The body of the action may or not have been evaluated, depending on the return value of doStartTag.

If this method returns EVAL_PAGE, the rest of the page continues to be evaluated. If this method returns SKIP_PAGE, the rest of the page is not evaluated and the request is completed. If this request was forwarded or included from another page (or Servlet), only the current page evaluation is completed.

The JSP container will resynchronize any variable values that are indicated as so in TagExtraInfo after the invocation of doEndTag().

Throws:
JspException. -  

<!---->

release

public void release()
Called on a Tag handler to release state. The page compiler guarantees that JSP page implementation objects will invoke this method on all tag handlers, but there may be multiple invocations on doStartTag and doEndTag in between.

<!---->

<script src="/js/omi/jsc/s_code_remote.js" language="JavaScript" type="text/javascript"></script>
分享到:
评论

相关推荐

    basemap-1.3.9-cp311-cp311-win_amd64.whl.zip

    在这里,`&lt;package_name&gt;`是Basemap,`&lt;version&gt;`是1.3.9,`&lt;python_tag&gt;`反映了Python版本(cp311代表Python 3.11),`&lt;abi_tag&gt;`(Application Binary Interface Tag)同样表示Python 3.11,而`&lt;platform_tag&gt;`是...

    Python库 | bable_interface-1.1.0-py3-none-linux_armv7l.whl

    - 文件名结构为:`&lt;package&gt;-&lt;version&gt;-&lt;python_tag&gt;-&lt;abi_tag&gt;-&lt;platform_tag&gt;.whl`。在这个例子中,`bable_interface`是包名,`1.1.0`是版本号,`py3`表示它是为Python 3设计的,`none`表示没有特定的ABI(应用...

    iPhone Application Programming L02: Interface Builder

    NSString *message = [NSString stringWithFormat:@"Guten Tag %@, du bist der %d. Besucher.", name, count]; NSString *messageLong = [message stringByAppendingString:@"Vielen Dank!"]; int code = [[@"404" ...

    cacti_interface_ip解析1

    在这个解析中,我们将重点讨论`interface_ip`对象及其在Cacti中的作用。 `interface_ip`是Cacti与McPAT(Multi-Chip Power Analyzer)之间通信的关键组件。McPAT是一个多芯片功耗分析工具,而`interface_ip`对象则...

    HMI PROFESSIONAL EDITION - TAG MANAGEMENT_hmi_modbus_workerf7w_V

    HMI(Human Machine Interface)是人机交互界面,是工业自动化系统中不可或缺的一部分,它使得操作员能够与设备或控制系统进行直观、有效的通信。在“HMI PROFESSIONAL EDITION - TAG MANAGEMENT_hmi_modbus_workerf...

    NFC fourm doc

    NFC Controller Interface (NCI) Technical Specification 1.1.pdf NFC Data Exchange Format (NDEF) Technical Specification.pdf NFC Forum Type 1 Tag Operation Specification 1.2.pdf NFC Forum Type 3 Tag ...

    MPI‘s C++ Interface

    消息传递接口(Message Passing Interface,简称MPI)是并行计算领域中最广泛使用的标准之一,它提供了一套通用的API(应用程序编程接口),使得开发者能够在分布式内存架构上编写高性能的并行程序。随着C++语言在科学...

    NFC全套英文协议文档

    NFC标签类型技术规范(NFC Forum Tag TypeTechnical Specifications ) ; 记录类型定义技术规范(Record Type Definitionf Technical Specifications); 参考应用技术规范(Reference Application Technical ...

    golang中struct和interface的基础使用教程

    ### 结构体标签(Tag) 结构体标签常用于序列化和反序列化,比如与JSON或XML转换。通过在字段定义后加上`json`标签,可以指定字段在JSON中的映射。例如: ```go type User struct { Name string `json:"userName...

    IOS应用源码之3D TAG 云.rar

    8. **iOS设计指南**:遵循Apple的Human Interface Guidelines,确保应用的用户体验符合苹果的标准。 通过研究这个项目,开发者可以学习到iOS应用的整体开发流程,以及3D图形技术和云服务集成的具体实践,对于提升...

    MDI多文档tag bar实现,包括最小化程序到任务栏并有图标闪烁功能(vc源码)

    MDI(Multiple Document Interface)是Windows应用程序中一种常见的设计模式,允许用户在同一应用程序窗口中同时打开和操作多个文档。在本资源中,我们探讨的是如何在VC++环境下实现MDI应用中的“tag bar”功能,...

    TIA博途中如何通过画面编号+数值更改事件实现画面跳转?.docx

    在TIA博途中,通过画面编号和数值更改事件实现画面跳转是一种常用的操作,它可以方便地帮助用户在多个HMI(Human Machine Interface,人机交互界面)画面之间切换。以下将详细解释这一过程: 首先,我们需要创建一...

    FBM0AARILV8B90P_tag_

    JNA(Java Native Access)是Java平台的一个库,它允许Java代码直接调用操作系统原生API,无需编写C语言的JNI(Java Native Interface)代码。这个名字表明这是JNA库的3.2.7版本的源代码版本。 现在,让我们深入...

    ST Microelectronics AD DXP PCB 封装库(.IntLib)

    ST Memory Cache-Tag RAM.IntLib ST Memory EEPROM Flash.IntLib ST Memory EEPROM Parallel.IntLib ST Memory EEPROM Serial.IntLib ST Memory EPROM 1-16 Mbit.IntLib ST Memory EPROM 16-512 Kbit.IntLib ST ...

    NFCForum-TS-T2T-1.1

    该规范提供了一些专业术语的解释,如Type 2 Tag、RF Interface等。 10. Radio Frequency (RF) Interface 该规范对Type 2 Tag的RF接口进行了详细的描述,包括RF信号的频率、调制方式、数据传输速率等。 11. ...

    jsf tag document

    7. **富客户端接口(Rich Client Interface)** JSF与Ajax技术结合,例如使用`&lt;rich:component&gt;`标签(RichFaces扩展),可以创建富客户端界面,实现部分页面更新,提高用户体验。 8. **整合其他技术** JSF可以与...

    TIA博途WINCC中如何获取当前画面编号并发送给PLC?.docx

    而WINCC是TIA博途中的人机界面(Human Machine Interface,HMI)部分,用于监控和交互操作。在本教程中,我们将探讨如何在TIA博途WINCC中获取当前画面编号并将其发送给PLC,以便于PLC根据画面变化执行不同的逻辑控制...

    scwcd考试中常用的API

    - **interface: JspTag** - **interface: SimpleTag** - **class: SimpleTagSupport** - **interface: Tag** - **interface: IterationTag** - **interface: BodyTag** - **class: TagSupport** - **class: ...

    自定义标签的简单例子

    tld中 &lt;tag&gt; &lt;name&gt;hello_int&lt;/name&gt;&lt;br&gt; &lt;tag-class&gt;com.jspdev.ch11.HelloTag_Interface&lt;/tag-class&gt; &lt;body-content&gt;empty&lt;/body-content&gt;&lt;br&gt; &lt;/tag&gt; xml中 &lt;taglib&gt;&lt;br&gt; &lt;taglib-uri&gt;/...

Global site tag (gtag.js) - Google Analytics