Prentice Hall and Sun Microsystems. Personal use only; do not redistribute.
322
Chapter 14 Creating Custom JSP Tag Libraries
Listing 14.8 csajsp taglib.tld (continued)
1.0
1.1
csajsp
A tag library from Core Servlets and JavaServer Pages,
http://www.coreservlets.com/.
prime
coreservlets.tags.PrimeTag
Outputs a random N digit prime.
EMPTY
length
false
The JSP File
Listing 14.9 shows a JSP document that uses the
taglib
directive to load the
tag library descriptor file and to specify a prefix of
csajsp
. Since the
prime
tag is defined to permit a
length
attribute, Listing 14.9 uses
Remember that custom tags follow XML syntax, which requires attribute
values to be enclosed in either single or double quotes. Also, since the
length
attribute is not required, it is permissible to use
The tag handler is responsible for using a reasonable default value in such
a case.
Figure 14 3 shows the result of Listing 14.9.
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