Presented by developerWorks, your source for great tutorials
ibm.com/developerWorks
Notice that you added the subtask jsptaglib to create a TLD file called
mytaglib
under
the
WEB INF
directory of your Web application as follows:
jspversion="1.2"
destdir="${WEBINF}/tlds"
shortname="basic"
filename="mytaglib.tld"/>
Also notice that you added a sub element under the
deploymentdescriptor
sub task
to generate the taglib declaration in the
web.xml
file as follows:
destdir="${WEBINF}" >
location="WEB INF/tlds/mytaglib.tld"
/>
The above would generate the following entry in the
web.xml
file as follows:
mytaglib
WEB INF/tlds/mytaglib.tld
Testing your new JSP Custom Tag
Granted this JSP Custom tag is basic and does not do much but it does work and
demonstrates a lot of the features you can implement with Custom Tags There is a
JSP file called
happy.jsp
in the docroot of this project. Once you run the Ant deploy
target, you can edit the JSP file and try all the alternatives. Essentially, it will iterate the
body as many times as you specify with the iterate attribute. The includeBody attribute
flags specifies whether or not the body should be included, and the includePage
attribute specifies whether or not the rest of the JSP file should be evaluated. I tried
many permutations and it works as advertised.
<%@page contentType="text/html"%>
<%@taglib uri="mytaglib" prefix="mytag"%>
Enhance J2EE component reuse with XDoclets
Page 25 of 49
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