{"id":1712,"date":"2011-03-17T17:14:15","date_gmt":"2011-03-17T11:44:15","guid":{"rendered":"http:\/\/JitendraZaa.com\/blog\/?p=1712"},"modified":"2011-03-17T17:14:15","modified_gmt":"2011-03-17T11:44:15","slug":"life-cycle-of-jsp-tag-interface","status":"publish","type":"post","link":"https:\/\/www.jitendrazaa.com\/blog\/java\/jsp\/life-cycle-of-jsp-tag-interface\/","title":{"rendered":"Life cycle of JSP Tag interface"},"content":{"rendered":"<p><strong>Tag interface:<\/strong><br \/>\nThe interface of a classic tag handler that <strong>does not want to manipulate its body<\/strong>. The Tag interface defines the basic protocol between a Tag handler and JSP page implementation class.<\/p>\n<p><strong>Properties:<\/strong><br \/>\nThe Tag interface specifies the setter and getter methods for the core <strong>pageContext <\/strong>and <strong>parent <\/strong>properties.<\/p>\n<p><strong>Methods:<\/strong><br \/>\nThere are two main actions: <strong>doStartTag <\/strong>and <strong>doEndTag<\/strong>. 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).<\/p>\n<p><strong>Empty and Non-Empty Action:<\/strong><br \/>\nIf the TagLibraryDescriptor file indicates that the action must always have an empty action, by an  entry of &#8220;empty&#8221;, then the doStartTag() method must return <em>SKIP_BODY<\/em>.<br \/>\nOtherwise, the doStartTag() method may return <em>SKIP_BODY<\/em> or <em>EVAL_BODY_INCLUDE<\/em>.<\/p>\n<p>If <em>SKIP_BODY <\/em>is returned the body, if present, is not evaluated.<br \/>\nIf <em>EVAL_BODY_INCLUDE <\/em>is returned, the body is evaluated and &#8220;passed through&#8221; to the current out.<\/p>\n<p><strong>Life Cycle:<\/strong><\/p>\n<figure id=\"attachment_1713\" aria-describedby=\"caption-attachment-1713\" style=\"width: 451px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/jitendrazaa.com\/blog\/wp-content\/uploads\/2011\/03\/Life-Cycle-of-Tag-Interface.jpg?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-1713\" title=\"Life Cycle of Tag Interface\" src=\"https:\/\/i0.wp.com\/jitendrazaa.com\/blog\/wp-content\/uploads\/2011\/03\/Life-Cycle-of-Tag-Interface.jpg?resize=451%2C394&#038;ssl=1\" alt=\"Life Cycle of Tag Interface\" width=\"451\" height=\"394\" \/><\/a><figcaption id=\"caption-attachment-1713\" class=\"wp-caption-text\">Life Cycle of Tag Interface<\/figcaption><\/figure>\n<p><!--more-->1.The tags may have the default values, so the default values are readed and after that <strong>setPageContext()<\/strong>, <strong>setParent()<\/strong> and the <strong>setters <\/strong>of all the attributes are invoked.<br \/>\n2. After the initialization of all the properties <strong>doStartTag() <\/strong>method is envoked. It may return <em>SKIP_BODY <\/em>or <em>EVAL_BODY_INCLUDE<\/em>.<br \/>\n3. <strong>doEndTag()<\/strong> is called  if and only if the tag ends normally without raising an exception.<br \/>\n4. Some setters may be called again before tag handler is reused.<br \/>\n<strong><\/strong><\/p>\n<blockquote><p><strong>Example :<\/strong> setParent() is called if it is reused within the same page but at different level, setPageContext() is called if its used in another page and attribute setters are called if the values differs.<\/p><\/blockquote>\n<p>5.Once all invocations on the tag handler are completed, the <strong>release()<\/strong> 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. <strong>The page compiler guarantees that release() will be invoked on the Tag handler before the handler is released to the GC.<\/strong><\/p>\n<p><strong><\/strong>Next article :\u00a0<a title=\"Life cycle of jsp BodyTag interface\" href=\"https:\/\/jitendrazaa.com\/blog\/java\/life-cycle-of-jsp-bodytag-interface\/\" target=\"_blank\">Life Cycle of JSP &#8220;BodyTag&#8221; interface<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Life cycle of JSP Tag interface in Java<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"advanced_seo_description":"","jetpack_seo_html_title":"","jetpack_seo_noindex":false,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"jz_research_post":"","_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4],"tags":[330],"class_list":["post-1712","post","type-post","status-publish","format-standard","hentry","category-jsp","tag-jsp"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":1716,"url":"https:\/\/www.jitendrazaa.com\/blog\/java\/jsp\/life-cycle-of-jsp-bodytag-interface\/","url_meta":{"origin":1712,"position":0},"title":"Life cycle of JSP BodyTag interface","author":"Jitendra","date":"March 17, 2011","format":false,"excerpt":"Life cycle of JSP BodyTag interface","rel":"","context":"In &quot;JSP&quot;","block_context":{"text":"JSP","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/java\/jsp\/"},"img":{"alt_text":"Life cycle of IterationTag and BodyTag interface in JSP","src":"https:\/\/i0.wp.com\/jitendrazaa.com\/blog\/wp-content\/uploads\/2011\/03\/Life-cycle-of-IterationTag-and-BodyTag-interface-in-JSP.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":1724,"url":"https:\/\/www.jitendrazaa.com\/blog\/java\/how-to-create-jsp-custom-tag-using-bodytag-interface-or-bodytagsupport\/","url_meta":{"origin":1712,"position":1},"title":"How to Create JSP Custom Tag \u2013 using BodyTag interface or BodyTagSupport","author":"Jitendra","date":"March 17, 2011","format":false,"excerpt":"Tutorial on How to Create JSP Custom Tag \u2013 using BodyTag interface or BodyTagSupport","rel":"","context":"In &quot;JAVA&quot;","block_context":{"text":"JAVA","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/java\/"},"img":{"alt_text":"How to Create Custom Tag in JSP","src":"https:\/\/i0.wp.com\/jitendrazaa.com\/blog\/wp-content\/uploads\/2011\/03\/How-to-Create-Custom-Tag-in-JSP.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":1720,"url":"https:\/\/www.jitendrazaa.com\/blog\/java\/how-to-create-jsp-custom-tag-using-tag-interface-or-tagsupport\/","url_meta":{"origin":1712,"position":2},"title":"How to Create JSP Custom Tag \u2013 using Tag interface or TagSupport","author":"Jitendra","date":"March 17, 2011","format":false,"excerpt":"Tutorial of creating JSP Custom Tag \u2013 using Tag interface or TagSupport in JAVA","rel":"","context":"In &quot;JAVA&quot;","block_context":{"text":"JAVA","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/java\/"},"img":{"alt_text":"How to Create Custom Tag in JSP","src":"https:\/\/i0.wp.com\/jitendrazaa.com\/blog\/wp-content\/uploads\/2011\/03\/How-to-Create-Custom-Tag-in-JSP.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":2017,"url":"https:\/\/www.jitendrazaa.com\/blog\/java\/java-j2ee-interview-questions-1\/","url_meta":{"origin":1712,"position":3},"title":"Java &#8211; J2EE Interview Questions &#8211; 1","author":"Jitendra","date":"April 15, 2011","format":false,"excerpt":"JAVA - J2EE Interview Questions - 1, JAVA - J2EE Interview Questions - 1,custom tag JSP, Externalization , serialVersionUID, difference between interface and abstract class, iterate HashMap","rel":"","context":"In &quot;JAVA&quot;","block_context":{"text":"JAVA","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/java\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1707,"url":"https:\/\/www.jitendrazaa.com\/blog\/java\/jsp\/setup-application-to-use-javaserver-pages-standard-tag-libraryjstl\/","url_meta":{"origin":1712,"position":4},"title":"Setup application to use JavaServer Pages Standard Tag Library(JSTL)","author":"Jitendra","date":"March 17, 2011","format":false,"excerpt":"Setup application to use JavaServer Pages Standard Tag Library(JSTL)","rel":"","context":"In &quot;JSP&quot;","block_context":{"text":"JSP","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/java\/jsp\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1460,"url":"https:\/\/www.jitendrazaa.com\/blog\/java\/jsp\/setting-session-timeout-in-jsp-servlet\/","url_meta":{"origin":1712,"position":5},"title":"Setting Session Timeout in JSP Servlet","author":"Jitendra","date":"February 7, 2011","format":false,"excerpt":"How to set the Session Time out in JSP and Servlet","rel":"","context":"In &quot;JSP&quot;","block_context":{"text":"JSP","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/java\/jsp\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/posts\/1712","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/comments?post=1712"}],"version-history":[{"count":0,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/posts\/1712\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/media?parent=1712"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/categories?post=1712"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/tags?post=1712"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}