ibm.com/developerWorks
Presented by developerWorks, your source for great tutorials
}
Note that the JavaDoc tag
jsp.attribute
is used to define the property as an
attribute. This code generates the following in the TLD file within the definition:
Custom tags, with all of their variables and attributes, can be hard to manage and keep
in sync. As you can see from the example, XDoclet can make short order of what
would otherwise be chaos, and it allows you to define all of this needed metadata in
one file instead of two. This makes doing custom tags a lot easier  maybe easy enough
for you to start fitting Custom Tags into your project.
Imagine refactoring and changing the name of a getter and setter method
corresponding to an attribute. Without XDoclet you would have to spelunk through the
TLD file. What a pain!
This is all well and good, but how do you take the Java source files and generate the
TLD file?
Adding TagLib generation to XDoclet
You need to write an Ant script that uses the
webdoclet
task from XDoclet. The listing
below modifies the code from the earlier
webdoclet
listing to add support for custom
tags under the target
generateDD
. Just as before, the input files for the
webdoclet
task are specified with a nested fileset, except, this time you added a new include
directive to include your tag handler (that is,
/>
). The jsptaglib subtask generates the TLD file as follows:
destdir="${WEBINF}" >
location="WEB INF/tlds/mytaglib.tld"
/>
jspversion="1.2"
destdir="${WEBINF}/tlds"
shortname="basic"
filename="mytaglib.tld"/>
Page 24 of 49
Enhance J2EE component reuse with XDoclets






footer




 

 

 

 

 Home | About Us | Network | Services | Support | FAQ | Control Panel | Order Online | Sitemap | Contact

j2ee web hosting

 

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