Leandro Melo
SCJP 1.4, SCWCD 1.4
Leandro Melo
SCJP 1.4, SCWCD 1.4
Kapil Munjal
SCJP 1.4, SCWCD 1.4
Leandro Melo
SCJP 1.4, SCWCD 1.4
Kapil Munjal
SCJP 1.4, SCWCD 1.4
Specifying the taglib directive
You need to specify the taglib directive in order to pick up the tags that you are going to put into the document. You specify the TLD file so that Page Designer can show you what tags are available in that TLD
Prerequisites:
Adding the Tag Library Descriptor (TLD) file.
Adding a taglib directive to a JSP file.
You can specify taglib directives in one of four ways:
Using the taglib-uri value in the Web deployment descriptor, as follows:
<%@ taglib uri="/yeartags" prefix="year" %>
<%@ taglib uri="http://www.mycorp/monthtags" prefix="month" %>
where both /yeartags and http://www.mycorp/monthtags are taglib-uri values that are defined in the Web deployment descriptor.
Using the context-relative path that refers directly to the TLD or JAR file, as follows:
<%@ taglib uri="/tlds/datetags.tld" prefix="date" %>
where /tlds/datetags.tld is a context-relative URI to the TLD file.
Using a page-relative path that refers directly to the TLD or JAR file, as follows:
<%@ taglib uri="../WEB-INF/tlds/hourtags.jar" prefix="hour" %>
where ../WEB-INF/tlds/hourtags.jar is a page-relative URI to the JAR file.
For a J2EE 1.3 Web project only, using the URI element value defined in the TLD, as follows:
<%@ taglib uri="http://www.mycorp/minutetags" prefix="minute" %>
where http://www.mycorp/minutetags is the URI element value that is defined in the TLD.
Tip: In a case where two or more TLDs are deployed inside a JAR file, you can use this format to specify each TLD.
Now that you have specified your taglib directive, you can add a custom tag to your JSP file. When you choose to insert a custom tag, Page Designer references the taglib directive and displays the tags from that custom library.
Kapil Munjal
SCJP 1.4, SCWCD 1.4
<%@ taglib uri="testEL.tld" prefix="classic" %>
Consider Paul's rocket mass heater. |