A TLD contains information about a library as a whole and about each tag contained in the library. Tag Library DescriptorsĪ tag library descriptor (TLD) is an XML document that describes a tag library. If the tag is nested, a tag handler also has access to the handler (called the parent) associated with the enclosing tag.Ī set of related tag handler classes (a tag library) is usually packaged and deployed as a JAR archive. Such attributes are accessed using Attribute methods. Implicit objects can have named attributes associated with them. The entry point to the API is the page context object ( ), through which a tag handler can retrieve all the other implicit objects (request, session, and application) accessible from a JSP page. Table 15-1 Tag Handler Methods Tag Handler TypeĭoStartTag, doEndTag, set/getAttribute1.N, releaseĭoStartTag, doAfterBody, doEndTag, releaseĭoStartTag, doEndTag, release, doInitBody, doAfterBody, releaseĪ tag handler has access to an API that allows it to communicate with the JSP page. In order to provide a tag handler implementation, you must implement the methods, summarized in Table 15-1, that are invoked at various stages of processing the tag. For further information, see Tags with Bodies. Additional methods are invoked in between when a tag handler needs to interact with the body of the tag. When the end tag of a custom tag is encountered, the handler's doEndTag method is invoked. When the start tag of a custom tag is encountered, the JSP page's servlet calls methods to initialize the appropriate handler and then invokes the handler's doStartTag method. Tag handler methods defined by the Tag and BodyTag interfaces are called by the JSP page's servlet at various points during the evaluation of the tag. These classes and interfaces are contained in the package. For newly created handlers, you can use the TagSupport and BodyTagSupport classes as base classes. Interfaces can be used to take an existing Java object and make it a tag handler. Tag handlers must implement either the Tag or BodyTag interface. Tag HandlersĪ tag handler is an object invoked by a Web container to evaluate a custom tag during the execution of the JSP page that references the tag. This section describes the properties of tag handlers and TLDs and explains how to develop tag handlers and library descriptor elements for each type of tag introduced in the previous section. Declare the tag in a tag library descriptor.Develop a tag handler and helper classes for the tag.Defining Tags The Java TM Web Services Tutorial
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |