29.01.2013 Views

WebSphere Application Server - IBM Redbooks

WebSphere Application Server - IBM Redbooks

WebSphere Application Server - IBM Redbooks

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Tag library descriptor (TLD)<br />

The hello tag is packaged in a taglib. The TLD provides the Web container with<br />

the information it needs about the taglib, including the tag handler class<br />

information and the attributes of the tag. The TLD for hello is shown in<br />

Example 9-3.<br />

Example 9-3 Simple custom tag example: j2eebook.tld<br />

<br />

<br />

<br />

<br />

1.0<br />

1.1<br />

j2eebook<br />

Tag examples from ITSO J2EE Redbook<br />

<br />

hello<br />

com.ibm.itso.j2eebook.tagexamples.HelloTag<br />

empty<br />

<br />

Takes a name and says hello<br />

<br />

<br />

name<br />

true<br />

<br />

<br />

<br />

The TLD is an XML document that describes the contents of a tag library to the<br />

Web container. It helps the container identify custom tags within a JSP page, find<br />

the tag handler, recognize the attributes of the tag, and in combination with any<br />

TEI, validate the tag.<br />

Note: The JSP container uses the TagExtraInfo (TEI) class at translation time<br />

to provide information over and above that provided by the TLD.<br />

The structure of the TLD is pretty self-explanatory. As an XML file, the TLD<br />

contains a standard XML root element and DTD statement.<br />

Chapter 9. Using tag libraries 283

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!