Class 2 |
Intermediate Java 30-IT-397 |
|
Making Use of the Tag Body
-
In the previous example, we still had to use the </td> tag manually.
Perhaps it would be better if we could encapsulate the entire table cell
in one tag.
-
Using the body allows us to do that, and much more. But it does require
a little extra effort.
-
In the doStartTag() method, we've been returning SKIP_BODY. Now we
have to return EVAL_BODY_INCLUDE to state that we want to look at the body.
-
This body can contain text, or JSP code.
-
If we want to do something after the body has been evaluated, we do it
in the doEndTag() method, which is similar to doStartTag().
-
This time, return SKIP_PAGE if we want to finish processing the page at
this point.
-
The more common approach is to return EVAL_PAGE so that we can continue
processing the remainder of the page.
-
Let's go ahead and turn our Row tag into a tag that completely generates
a cell.
What we need to change...

Created by: Brandan Jones
December 17, 2001