|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
The Tag interface defines the basic protocol between a Tag handler and JSP page implementation class. It defines the life cycle and the methods to be invoked at start and end tag.
There are several methods that get invoked to set the state of a Tag handler. The Tag handler is required to keep this state so the page compiler can choose not to reinvoke some of the state setting.
The page compiler guarantees that setPageContext and setParent will all be invoked on the Tag handler, in that order, before doStartTag() or doEndTag() are invoked on it. The page compiler also guarantees that release will be invoked on the Tag handler before the end of the page.
Here is a typical invocation sequence:
ATag t = new ATag();
-- need to set required information
t.setPageContext(...);
t.setParent(...);
t.setAttribute1(value1);
t.setAttribute2(value2);
-- all ready to go
t.doStartTag();
t.doEndTag();
... other tags and template text
-- say one attribute is changed, but parent and pageContext have not changed
t.setAttribute2(value3);
t.doStartTag()
t.doEndTag()
... other tags and template text
-- assume that this new action happens to use the same attribute values
-- it is legal to reuse the same handler instance, with no changes...
t.doStartTag();
t.doEndTag();
-- OK, all done
t.release()
The Tag interface also includes methods to set a parent chain, which is used to find enclosing tag handlers.
Field Summary | |
static int |
EVAL_BODY_INCLUDE
Evaluate body into existing out stream. |
static int |
EVAL_PAGE
Continue evaluating the page. |
static int |
SKIP_BODY
Skip body evaluation. |
static int |
SKIP_PAGE
Skip the rest of the page. |
Method Summary | |
int |
doEndTag()
Process the end tag. |
int |
doStartTag()
Process the start tag for this instance. |
Tag |
getParent()
|
void |
release()
Called on a Tag handler to release state. |
void |
setPageContext(PageContext pc)
Set the current page context. |
void |
setParent(Tag t)
Set the current nesting Tag of this Tag. |
Field Detail |
public static final int SKIP_BODY
public static final int EVAL_BODY_INCLUDE
public static final int SKIP_PAGE
public static final int EVAL_PAGE
Method Detail |
public void setPageContext(PageContext pc)
This value is *not* reset by doEndTag() and must be explicitly reset by a page implementation
public void setParent(Tag t)
This value is *not* reset by doEndTag() and must be explicitly reset by a page implementation. Code can assume that setPageContext has been called with the proper values before this point.
public Tag getParent()
public int doStartTag() throws JspException
BodyTag
public int doEndTag() throws JspException
public void release()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |