Prentice Hall and Sun Microsystems. Personal use only; do not redistribute.
318
Chapter 14 Creating Custom JSP Tag Libraries
Listing 14.5 csajsp taglib.tld (continued)
simplePrime
coreservlets.tags.SimplePrimeTag
Outputs a random 50 digit prime.
EMPTY
The JSP File
JSP documents that make use of custom tags need to use the
taglib
directive,
supplying a
uri
attribute that gives the location of the tag library descriptor file
and a
prefix
attribute that specifies a short string that will be attached (along
with a colon) to the main tag name. Listing 14.6 shows a JSP document that uses
<%@ taglib uri="csajsp taglib.tld" prefix="csajsp" %>
to use the TLD file just shown in Listing 14.5 with a prefix of
csajsp
. Since
the base tag name is
simplePrime
, the full tag used is
Figure 14 2 shows the result.
Listing 14.6 SimplePrimeExample.jsp
Some 50 Digit Primes
HREF="JSP Styles.css"
TYPE="text/css">
Some 50 Digit Primes
<%@ taglib uri="csajsp taglib.tld" prefix="csajsp" %>
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