学习心得 - 自定义标签(下)
发表于:2007-07-04来源:作者:点击数:
标签:
16. Tag接口的方法 答:interface javax.servlet.jsp.tagext.Tag ------------------------------------------------------ +EVAL_BODY_INCLUDE:int +EVAL_PAGE:int +SKIP_BODY:int +SKIP_PAGE:int ------------------------------------------------------
16. Tag接口的方法
答:interface javax.servlet.jsp.tagext.Tag
------------------------------------------------------
+EVAL_BODY_INCLUDE:int
+EVAL_PAGE:int
+SKIP_BODY:int
+SKIP_PAGE:int
------------------------------------------------------
+release():void
+getParent():javax.servlet.jsp.tagext.Tag
+setParent(javax.servlet.jsp.tagext.Tag):void
+doEndTag():int
+doStartTag():int
+setPageContext(javax.servlet.jsp.PageContext):void
17. Tag的生命周期
答:1) setPageContext(javax.servlet.jsp.PageContext):void
2) setParent(javax.servlet.jsp.tagext.Tag):void
3) //setAttribute:void
4) doStartTag():int
5) doEndTag():int
6) release():void
18. BodyTag和Tag接口的关系
答:interface javax.servlet.jsp.tagext.BodyTag --> interface javax.servlet.jsp.tagext.Tag
------------------------------------------
+EVAL_BODY_AGAIN:int
------------------------------------------
+doInitBody():void
+setBodyContent(javax.servlet.jsp.tagext.BodyContext):void
+doAfterBody():int
19. BodyTag的处理过程
答:1) setPageContext(javax.servlet.jsp.PageContext):void
2) setParent(javax.servlet.jsp.tagext.Tag):void
3) //setParent()
4) doStartTag():int
5) setBodyContent(javax.servlet.jsp.tagext.BodyContent):void
6) doInitBody():void
7) doAfterBody():int
doEndTag():int
9) release():void
20. SimpleTag接口的方法
答:javax.servlet.jsp.tagext.SimpleTag
------------------------------------------
+doTag():void
+getParent():JspTag
+setJspBody(JspFragment jspBody):void
+setJspContext(JspContext pc):void
+setParent(JspTag parent):void
21. SimpleTage接口的生命周期
答:1) new:
每次遇到标签,容器构造一个SimpleTag的实例,这个构造方法没有参数。和红典的标签一样,SimpleTag不能缓冲,故不能重用,每次都需要构造新的实例。
2) setJspContext()、setParent(): 只有这个标签在另一个标签之内时,才调用setParent()方法;
3) 设置属性:调用每个属性的setter方法;
4) setJspBody();
5) doTag(): 所有标签的逻辑、迭代和Body计算,都在这个方法中;
6) return
原文转自:http://www.ltesting.net