JavaServer Pages Standard Tag Library
JavaServer Pages Standard Tag Library
JavaServer Pages Standard Tag Library
The JavaServer Pages Standard Tag Library (JSTL) encapsulates core functionality common to
many JSP applications. Instead of mixing tags from numerous vendors in your JSP applications,
JSTL allows you to employ a single, standard set of tags. This standardization allows you to
deploy your applications on any JSP container supporting JSTL and makes it more likely that
the implementation of the tags is optimized.
JSTL has tags such as iterators and conditionals for handling flow control, tags for manipulating
XML documents, internationalization tags, tags for accessing databases using SQL, and
commonly used functions.
This chapter demonstrates JSTL through excerpts from the JSP version of the Duke's Bookstore
application discussed in the earlier chapters. It assumes that you are familiar with the material
in the
section of
This chapter does not cover every JSTL tag, only the most commonly used ones. Please refer to
the reference pages at
for a complete
list of the JSTL tags and their attributes.
The Example JSP Pages
This chapter illustrates JSTL using excerpts from the JSP version of the Duke's Bookstore
application discussed in
Here, they are rewritten to
replace the JavaBeans component database access object with direct calls to the database using
the JSTL SQL tags. For most applications, it is better to encapsulate calls to a database in a bean.
JSTL includes SQL tags for situations where a new application is being prototyped and the
overhead of creating a bean may not be warranted.
The source for the Duke's Bookstore application is located in the
tut-install/javaeetutorial5/examples/web/bookstore4/ directory created when you unzip
the tutorial bundle (see
7
C H A P T E R
7
201