May 2004
Beginner to intermediate
1032 pages
23h 48m
English
Attributes are used to pass information into a custom tag to configure the behavior of the tag. Tag attributes are like XML or HTML attributes and are name/value pairs of data. The values must be quoted with single or double quotes.
A simple example might be a tag that lists the rows in a table given a JNDI DataSource and table name as attributes. Listing 14.6 shows how such a tag could be used.
<%@ taglib prefix="demo" uri="/demo.tld" %> <HTML> <HEAD><TITLE>Tag Library Lookup Demo</TITLE></HEAD> <BODY> <demo:lookup dataSource="java:comp/env/jdbc/Agency" table="${param.table}"/> <H2>Select a table to display:</H2> <FORM action='lookup' > <SELECT name="table"> <OPTION>Applicant</OPTION> ... |
Read now
Unlock full access