Question

I have a custom tag handler test/StubCTag.java that is a simpletag. There is a testing.tld file that defines the ctag:-

<?xml ... ?>
<taglib ...>
...
<tag>
<name>stubctag</name>
<tag-class>test.StubCTag</tag-class>
</tag>
</taglib>

When packaging this as a jar archive the files are layd out as follows:-

testing.jar
-----------
/META-INF/testing.tld
/META-INF/classes/test/StubCTag.class

When using the custom tag in a jsp page with prefix testprefix, browser shows a 'Unable to load tag handler class "test.StubCTag" for tag "testprefix:stubctag". I have double checked the archive and the tld and class files are present. I searched online but it didnt get me anything which mentions anything about placement of tag handlers as part of a library.

Could someone tell me how to package class files as a customtag library?

Was it helpful?

Solution 2

The jar in question contains tag handler classes and tags. I changed the file layout to

/META-INF/testing.tld
/test/StubCTag.class

rest remains same. No more errors, jsp page shows output as intended so problem solved.

OTHER TIPS

Could you to include your taglib this way:

<%@ taglib uri="uri element in tld" prefix="testprefix" %>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top