Releasing Resources
Releasing Resources
If your component does not have a renderer associated with it, getRendererType should return
null
. In this case, the renderer-type element in the application configuration file should also
be set to null.
Releasing Resources
It's recommended practice that all tag handlers implement a release method, which releases
resources allocated during the execution of the tag handler. The release method of MapTag as
follows:
public void release() {
super.release();
current = null;
styleClass = null;
actionListener = null;
immediate = null;
action = null;
}
This method first calls the UIComponentTag.release method to release resources associated
with UIComponentTag. Next, the method sets all attribute values to null.
Defining the Custom Component Tag in a Tag Library
Descriptor
To define a tag, you declare it in a TLD. The web container uses the TLD to validate the tag. The
set of tags that are part of the HTML render kit are defined in the html_basic TLD.
The custom tags area and map are defined in bookstore.tld. The bookstore.tld file defines
tags for all the custom components and the custom validator tag described in
All tag definitions must be nested inside the taglib element in the TLD. Each tag is defined by a
tag
element. Here is part of the tag definition of the map tag:
<tag>
<name>map</name>
<tag-class>taglib.MapTag</tag-class>
<attribute>
<name>binding</name>
<required>false</required>
<deferred-value>
<type>
Defining the Custom Component Tag in a Tag Library Descriptor
The Java EE 5 Tutorial · September 2007
434