`
glacier3
  • 浏览: 377750 次
  • 性别: 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>
分享到:
评论

相关推荐

    NFC全套英文协议文档

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

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

    自定义标签的简单例子

    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;/...

    RF_TEST.zip_LPC 2148

    RF tag interface with lpc 2148

    rpi_apriltag_streaming

    rpi_apriltag_streaming 1.安装要求 sudo apt install hostapd pip install flask pip install imutils pip install pupil-apriltags 2.设置接入点网络和dhcpcd文件以设置wlan0接口。 sudo nano /etc/hostapd/...

    路由器配置(详细介绍了各种路由器的配置方法)

    ip route prefix mask {address | interface} [distance] [tag tag] [permanent] Prefix :所要到达的目的网络 mask :子网掩码 address :下一个跳的IP地址,即相邻路由器的端口地址。 interface :本地网络接口 ...

    MyBatisCodeHelper-Pro.zip

    Full mybatis sql auto complete, recognize mybatis tag in xml, like where trim set include ect,provide sql completion after those tag Jump from mybatis dao interface to mapper xml each other Refactor ...

    DSLAN9210开通专线配置

    DSL(config)# vlan 3504 16/1 tag DSL(config)# vlan 3504 3/20 untag one-to-one - Increase vlan and interface at same time DSL(config)# vlan 3504 3/20 untag DSL(config)# interface dsl-mpvc 3/20...

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

    CISCO 技术大集合

    建立静态路由 ip route prefix mask {address | interface} [distance] [tag tag] [permanent] Prefix :所要到达的目的网络 mask :子网掩码 address :下一个跳的IP地址,即相邻路由器的端口地址。 interface :...

    simple-tags

    Tags: tag, posts, tags, admin, administration, tagging, navigation, terms, taxonomy Requires at least: 3.0 Tested up to: 3.3 Stable tag: 2.2 Add some tools for taxonomies : Terms suggestion, Mass ...

    9806H 数据配置

    ZXAN(config-if)#switchport vlan 2020,3005 tag 把该端口以tag方式加入VLAN注意此处2020管理vlan,3001语音vlan ZXAN(config-if)#authentication enable onu使能 ZXAN(config-if)# ZXAN(config-if)#bandwidth ...

    中兴OLT-FTTH

    voip-vlan profile vlan-12 tag-mode tag cvlan 12 priority 7 h248-profile h248 register-server ip 10.8.35.130 port 2944 h248-profile h248 backup-register-server ip 0.0.0.0 port 2944 h248-profile h248 ...

    物联网技术西电捷通TRAIS符合性检测系统的应用研究

    亟需安全机制的保障,我国在近年来加紧制定并相继颁布了多项RFID领域的国家标准,包括800/900MHz、2.45GHz频段RFID空中接口和测试国家标准等,由西电捷通公司研发的RFID空中接口安全(Tag And Reader Air Interface ...

    NekoHTML学习笔记.rar

    NekoHTML是一个简单地HTML扫描器和标签补偿器(tag balancer) ,使得程序能解析HTML文档并用标准的XML接口来访问其中的信息。...NekoHTML的开发使用了Xerces Native Interface (XNI),后者是Xerces2的实现基础。

    json:根据官方json增加新功能:1.增加结构体默认小写功能;2.增加map、list、slide转结构体的功能;3.修改默认不返回空数据。github.comweimingjuejson

    StructFirstLower=true表示首字母小写(tag的优先级最高,有tag则根据tag) 示例: type Test struct { Data int Data2 int `json:"D2"` } 赋值并解析成json:{"data":10,"D2":20} 2.增加map、list、slide转结构体...

    JSP Simple Examples

    sendRedirect() method is a method of HttpServletResponse interface. In sendRedirect() the object of request will be generated again with the location of page which will perform the request of the ...

    nekohtml-1.9.15.zip

    NekoHTML is written using the Xerces Native Interface (XNI) that is the foundation of the Xerces2 implementation. This enables you to use the NekoHTML parser with existing XNI tools without ...

    PL/SQL Developer中文语言包Chinese.lang及注册文件aalf.dat

    Tag: PlSQLDev 中文语言包 Chinese.lang aalf.dat PL/SQL Developer Language Settings语言设置: 改为简体中文 菜 单 栏: Tools -&gt;preferences-&gt;User Interface -&gt; Appearance -&gt; Language 从下拉菜单中选择 ...

Global site tag (gtag.js) - Google Analytics