Prentice Hall and Sun Microsystems. Personal use only; do not redistribute.
14.5 Optionally Including the Tag Body
329
Figure 14 4 The custom csajsp:heading element gives you much more control
over heading format than does the standard H1 through H6 elements in HTML.
14.5 Optionally Including the Tag
Body
Most tags either never make use of body content or always do so. This sec
tion shows you how to use request time information to decide whether or not
to include the tag body. Although the body can contain JSP that is interpreted
at page translation time, the result of that translation is servlet code that can
be invoked or ignored at request time.
The Tag Handler Class
Optionally including the tag body is a trivial exercise: just return
EVAL_BODY_INCLUDE
or
SKIP_BODY
depending on the value of some
request time expression. The important thing to know is how to discover
that request time information, since
doStartTag
does not have
Http
ServletRequest
and
HttpServletResponse
arguments as do
service
,
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