Prentice Hall and Sun Microsystems. Personal use only; do not redistribute.
338
Chapter 14 Creating Custom JSP Tag Libraries
Figure 14 7 The csajsp:filter element lets you insert text without worrying about
it containing special HTML characters.
14.7 Including or Manipulating the
Tag Body Multiple Times
Rather than just including or processing the body of the tag a single time, you
sometimes want to do so more than once. The ability to support multiple
body inclusion lets you define a variety of iteration tags that repeat JSP frag
ments a variable number of times, repeat them until a certain condition
occurs, and so forth. This section shows you how to build such tags.
The Tag Handler Class
Tags that process the body content multiple times should start by extending
BodyTagSupport
and implementing
doStartTag
,
doEndTag
, and, most
importantly,
doAfterBody
as before. The difference lies in the return value
of
doAfterBody
. If this method returns
EVAL_BODY_TAG
, the tag body is
evaluated again, resulting in a new call to
doAfterBody
. This process contin
ues until
doAfterBody
returns
SKIP_BODY
.
Second edition of this book: www.coreservlets.com; Sequel: www.moreservlets.com.
Servlet and JSP training courses by book's author: courses.coreservlets.com.
footer
Our partners:
PHP: Hypertext Preprocessor Best Web Hosting
Java Web Hosting
Jsp Web Hosting
Cheapest Web Hosting
Visionwebhosting.net Business web hosting division of Web
Design Plus. All rights reserved