Achieved the previous instance TagSupport class, and there is no direct use JspTag interface, but in fact tag handling class must be achieved JspTag interfaces. JspTag interface definition in javax.servlet.jsp.tagext package, it is just a marking interface does not define any methods, all tag handling class must implement this interface.
javax.servlet.jsptagext package also includes IterationTag interfaces, BodyTag interfaces, SimpleTag interfaces, TagSupport class, BodyTagSupport class and simpleTagSupport class, inheritance relation between them is as follows:
----------- Tag Interface
| ---------- IterationTag Interface
| --------------------- TagSupport class
| | |
| ---------------- BodyTag Interface |
| | |
| --------- BodyTagSupport class
----------- SimpleTag Interface
-------- SimpleTagSupport class
This interface defines the write tag address classes to achieve the basic methods, including what methods: doStartTag (), doEndTag (), getParent (), release () and setPageContext () method, which doStartTag () and doEndTag () method is the most commonly used method. doStartTag () method in the implementation of the custom tag is called when the start tag, doEndTag () method in the implementation of the custom tag's end tag is called.
Tag in the actual preparation of the class when dealing with the general without directly implement this interface, usually inherit this interface has been achieved or BodyTagSupport TagSupport class.
This interface inherits from the Tag interface and adds a new doAfterBody () method, this method can generally achieve the contents of custom tag that contains the cycle of operation.
doAfterBody () method only if the doStartTag () method returns a value of EVAL_BODY_INCLUDE only when called. Call doAfterBody () method, if the return value is EVAL_BODY_AGAIN, it will again run the custom tag that contains the content and once again call doAfterBody () method until the doAfterBody () method returns a value of SKIP_BODY, so that to realize the custom tag contains operational content.
This class is the most commonly used preparation of custom tag class, in fact it is a helper class that can help us to quickly write tag handler class, he realized IterationTag interfaces. We write tag handler class can inherit the class time, rewrite the way they need, without the need to directly interface to achieve IterationTag or Tag. The design model used here the default adapter mode.
An inherited class that TagSupport tag handling custom tag this tag can display the content contained, but can not edit the contents contained in and transform. If you need to edit the contents contained in the need to inherit BodyTagSupport class
TagSupport class call process is as follows:
Related Posts of Write your own custom tag library operating principle (4)
JTA in Spring Development Environment: JDK1.5 (sun) + Myeclipse6.0 + Tomcat5.5 + ant 1.7.1 + MySql5.0.4 Framework version: JSF1.2 (sun) + hibernate3.3.1.GA + spring2.5.6 JTA (Java Transaction API) Only supports the standard EJB Persistence (JTA) transacti
Today, the use of hibernate in the company encountered a troublesome problem, the use of hibernate when the primary key generation strategy set sequence, but always reported in the implementation could not get next sequence value of the error, then o ...
hibernate lock mechanism 1. Pessimistic lock It refers to the modification of data by outsiders hold a conservative attitude. The assumption that at any time access to data, may also have another client to access the same data, in order to maintain t ...
[Problem] Now, in the development of the so-called multi-storey JavaEE applications, data persistence layer is always essential, and "Automatic" of ORM - Hibernate, and "all-manual-type" of SqlMap - IBatis, equivalent data are Per ...
The use of hibernate, implementation of data persistence. Has the following several processes. One configuration database connection information. Hibernate.config 2 configuration mapping. 3 use: the use of the process are the following steps: 3.1: Ge ...
Servlet brief introduction: Servlet is a small application server Are used to complete the B / S architecture, the client requests the response to treatment Platform independence, performance, able to run thread Servlet API for Servlet provides the s ...
The origin of ideas are pretty long history of reasons: [Use iBATIS history] The use of iBATIS has been a long time, the system is to use the CRUD template tool to generate the code, although there are tools to generate, but looked at a lot of CRUD the Sq
hibernate Lazy strategy can be used in: <class> tag, it can be true / false Tags can <PROPERTY> values true / false type of necessary tools to enhance <set> <list> can tag values true / false / extra <many-to-one> <on ...