Tld is a simple xml file that provides detailed jsp (the preferred choice for SUN Enterprise Applications) tag Information (standardization is getting closer and closer). It creates a new DemoTags. tld is saved in the/WEB-INF/tlds file, code:
<? Xml (standardization is getting closer and closer) version = "1.0" encoding = "ISO-8859-1"?> <! DOCTYPE taglib PUBLIC "-// Sun Microsystems, Inc. // DTD jsp (preferred for SUN Enterprise Applications) Tag Library 1.1 // EN "http://java.sun.com/j2ee/dtds/web-jsp (preferred for SUN Enterprise applications) taglibrary_1_1.dtd "> <taglib> <tlibversion> 1.0 </tlibversion> <jsp (preferred for SUN Enterprise Applications)> 1.1 </jsp (preferred for SUN Enterprise applications) version> <shortname> DemoTags </shortname> <uri> http://www.stardeveloper.com </uri> <info> Demo Tags Library </info> <tag> <name> firsttag </name> <tagclass> com. stardeveloper. tag. test. firstTag </tagclass> <bodycontent> empty </bodycontent> <info> Your first jsp (preferred for SUN Enterprise applications) tag </info> <attribute> <name> name </name> <required> false </required> </attribute> </tag> </taglib>
Tag Library Descriptor
Note: All content is between <taglib> and </taglib>,
<? Xml (standardization is getting closer and closer) version = "1.0" encoding = "ISO-8859-1"?>
<! DOCTYPE taglib PUBLIC "-// Sun Microsystems, Inc. // DTD jsp (preferred for SUN Enterprise Applications) Tag Library 1.1 // EN"
"Http://java.sun.com/j2ee/dtds/web-jsp (preferred for SUN Enterprise Applications) taglibrary_1_1.dtd">
<Taglib>
Provides information about your tag library, which is almost the same among all tags;
<Tlibversion> 1.0 </tlibversion> indicates the current tag library version;
<Jsp (preferred for SUN Enterprise Applications) version> 1.1 </jsp (preferred for SUN Enterprise Applications) version> specifies the jsp (preferred for SUN Enterprise Applications) version;
<Shortname> DemoTags </shortname> indicates the name of the tag library;
<Uri> http://www.stardeveloper.com </uri>: Not very useful;
<Info> Demo Tags Library </info> is a simple description.
Now let's take a look at the content of <tag> and </tag>. <tag>
<Name> firsttag </name>
<Tagclass> com. stardeveloper. tag. test. FirstTag </tagclass>
<Bodycontent> empty </bodycontent>
<Info> Your first jsp (preferred for SUN Enterprise Applications) Tag </info>
<Attribute>
<Name> name </name>
<Required> false </required>
</Attribute>
</Tag>
Name is the short name before the prefix used for jsp (preferred for SUN Enterprise applications), for example, firsttag in <star: firsttag/>
Tagclass will contain the complete jsp (preferred for SUN Enterprise Applications) tag class path
Bodycontent should include one of the following: tagdependent, jsp (preferred for SUN Enterprise applications) and empty
Attribute tag describes each attribute. In this example, required is set to false. Therefore, this tag can be used without any input.