April 3, 2020
Estimated Post Reading Time ~

How to create and use a custom taglib - part 2 create and set up your TLD

The next step is to create your .tld directory.

In the taglib project, you will see under src/main/resources, that you have a META-INF directory.

In this directory, create a file named ProjectTaglib.tld

Add the following to this file:


<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<taglib xmlns="http://java.sun.com/xml/ns/javaee" version="2.1">
<tlib-version>5.4.0-SNAPSHOT</tlib-version>
<short-name>btes</short-name>
<uri>http://btes.com.au/tagexample</uri>
<tag>
<name>customTag</name>
<tag-class>au.com.btes.tagexample.CustomTag</tag-class>
<body-content>empty</body-content>
<attribute>
<name>content</name>
<required>true</required>
</attribute>
<attribute>
<name>isHeading</name>
<required>true</required>
</attribute>
</tag>
</taglib>


By aem4beginner

No comments:

Post a Comment

If you have any doubts or questions, please let us know.