10.7 Summary
Iteration is a crucial task in almost any web application, yet until the arrival of custom JSP
tags, it could only be accomplished using scriptlets. As we stated, iteration
scriptlets render the JSP code difficult to read and maintain, and even worse, place a
premium on the content developer's knowledge of Java. Custom tags fix these
problems at a reasonably low price.
We also presented a generic way to develop iteration tags. In fact, the code
developed for this chapter can be used in your own daily work (e. g., iteration on
something that is not an Array, Enumeration, or Iterator) with a relatively small
time investment. Simply extend IterateTag or IterationTagSupport, override a
method, and gain full access to the custom tag iteration functionality.
As a last phase in enhancing the quality and ease-of-use of our iteration tags,
body content processing was added to the iteration tags to make using the iterator
properties easier. This body content processing is by no means unique to iteration
tags. In fact, you can implement it in any tags that extend the BodyTag interface and
have complete control over their body. Body content processing in this way can
speed up the work of the JSP developer, by allowing you to introduce simple, proprietary
syntax in your JSPs. It should be considered an appealing alternative to
using smaller custom tags, such as the show tags that we developed, especially in
cases in which the size of the parsed content is small compared to the size of the
entire page.
Next we'll see how we can integrate custom tags with a database to provide simple
tag-based access to a database server.
New on the Java Boutique:
New Review:
Time Management Made Easy with the Quartz Enterprise Job Scheduler
Why not just use the Java timer API? This open source scheduling
API boasts simplicity, ease-of-integration, a well-rounded feature
set, and it's free!
New Applet:
Reverse Complement
Reverse Complement is a simple applet that converts DNA or RNA
sequences into three useful formats.
Elsewhere on internet.com:
WebDeveloper Java
Lots of Java information on webdeveloper.com
WDVL Java
Thorough Java resource at the Web Developer's Virtual Library.
ScriptSearch Java
Hundreds of free Java code files to download.
jGuru: Your View of the Java Universe
Customizable portal with online training, FAQs, regular news updates, and tutorials.
|