Tag lifecycle in JSP page

The following is the flow of methods that are called on a tag when it's encountered in a page: Two methods, setParent() and setPageContext(), are called on the TagHandler class. These methods are hand http://www.powerkp.info/linked/20130310.do led automatically by BodyTagSupport and TagSupport so you don't need to implement them explicitly if your tag extends either one of them. Any set methods for attributes on this tag are called. doStartTag() is called. If you haven't implemented this method, the flow continues. Otherwise you must return one of the following: SKIP_BODY: Instructs the engine to ignore the body for this tag if one exists EVAL_BODY_TAG: Instructs the engine to evaluate the body and call the Tag's doInitBody() method (relevant only for tags that implement the BodyTag interface; tags that extend from BodyTagSupport implement this interface) EVAL_BODY_INCLUDE: Instructs the engine to evaluate and include anything in the tag body; engine proceeds to step 7 (relevant only for tags that implement the BodyTag interface; tags that extend from BodyTagSupport implement this interface) setBodyContent() is called on the tag. This allows classes that extend BodyTagSupport to evaluate, manipulate and modify the body of the tag. doInitBody is called. Any initialization necessary before doAfterBody is called can be done here (setting up Connections, setting variables in the pageContext, etc.). doAfterBody is called. A return value of SKIP_BODY here will result in doEndTag() being called. Returning EVAL_BODY_TAG will produce another call to doAfterBody. doEndTag() is called. A return value of EVAL_PAGE here will result in the rest of the JSP page being evaluated by the engine. Returning SKIP_PAGE will tell the engine to ignore the rest of the page. http://www.star1234.info/linked/20130310.do 
posted @ 2013-03-11 05:37  chinadiy197601  阅读(146)  评论(0编辑  收藏  举报