L ISTING 19.6
// used by the parent tag.
// This is just good practice for when you start creating
// hierarchies of tags.
// Reset the name to an empty String
name = new String();
There are only a couple of new things to notice here. The first is the name attribute and the
setName() method. This is the attribute/method matching that is used to set attribute values as
we discussed earlier. The class level attribute name is prepended with set and the first letter of
the attribute is capitalized to perform this matching.
To deploy this new tag you need to add an entry to the tld , compile the HelloAttributeTag ,
and move the class file to the <SERVER_ROOT>/webapps/djs/WEB-INF/classes/com/djs/
directory. The code snippet that needs to be added to the tld follows:
<info>Just Says Hello to the Body</info>
The only real change to this tag element is the addition of the attribute element. In this ele-
ment you state three things. You first name the attribute, which is name for this tag. You then
state whether the attribute is required. This can be either true or false . The final addition to
the attribute element is the rtexprvalue element. This states whether the value of the
attribute can be an evaluated expression. The options are true or false .
To see this tag in action, use the JSP found in Listing 19.7.
L ISTING 19.7
<%@ taglib uri=”/djs” prefix=”djs” %>