Prentice Hall and Sun Microsystems. Personal use only; do not redistribute.
312
Chapter 14 Creating Custom JSP Tag Libraries
The format of tag descriptions will be described in later sections. For now,
just note that the
tag
element defines the main name of the tag (really tag
suffix, as will be seen shortly) and identifies the class that handles the tag.
Since the tag handler class is in the
coreservlets.tags
package, the fully
qualified class name of
coreservlets.tags.ExampleTag
is used. Note
that this is a class name, not a URL or relative path name. The class can
be installed anywhere on the server that beans or other supporting classes
can be put. With Tomcat 3.1, the standard base location is
install_dir/webapps/ROOT/WEB INF/classes
, so
ExampleTag
would be in
install_dir/webapps/ROOT/WEB INF/classes/coreservlets/tags
. Although
it is always a good idea to put your servlet classes in packages, a surprising
feature of Tomcat 3.1 is that tag handlers are required to be in packages.
Listing 14.2 csajsp taglib.tld
PUBLIC " //Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN"
"http://java.sun.com/j2ee/dtds/web jsptaglibrary_1_1.dtd">
"http://java.sun.com/j2ee/dtds/jsptaglibrary_1_2.dtd"
>
1.0
1.1
csajsp
A tag library from Core Servlets and JavaServer Pages,
http://www.coreservlets.com/.
example
coreservlets.tags.ExampleTag
Simplest example: inserts one line of output
EMPTY
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