Professional Java Server Programming J2EE Edition
Chapter 12
From the point of view of the JSP developer, the only significant new
feature of JSP 1.1 is support for tag extensions(often referred to as
custom tags). However, this proves to be very significant indeed.
Tag extensions look like HTML (or rather, XML) tags embedded in a JSP page.
They have a special meaning to a JSP engine at translation time, and enable
application functionality to be invoked without the need to
write Java code in JSP scriptlets. Well-designed tag extension libraries can enable application functionality to
be invoked without the appearance of programming.
So in this chapter, we'll look at the basics of writing your own tags and then in the next chapter we'll look at
some more advanced examples. So in this chapter we will cover:
-
Tag extension basics
-
The anatomy of a tag extension
-
How to deploy a tag library
-
How to write custom tag extensions
Let's get started then with what tag extensions are all about.
Tag Extension 101
Consider the <jsp:forward> action provided by the JSP specification. This tag dispatches the current
request to another page in the current web application. It can be invoked with the following syntax:
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.