11.7. Looping Without Generating BodyContent
In JSP 1.1, the only way to make an iterative tag is to return EVAL_BODY_TAG from the doAfterBody method, thus instructing the system to reevaluate the tag body. If the doStartTag returns EVAL_BODY_TAG, the system copies the tag body into a BodyContent object and invokes doAfterBody. The BodyTagSupport class overrides doStartTag to automatically return EVAL_BODY_TAG, so you only need to write doAfterBody when using BodyTagSupport. The problem with this approach is that doAfterBody must manually generate the tag body’s output by extracting it from the BodyContent object in which the system wraps the body. This is fine if you actually want to manipulate the body. But, if you merely want to iterate, ...
Get More Servlets and JavaServer Pages™ now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.