Question

I'm trying to use a taglib packaged in a jar in a web application.

The jar file contains:

/WEB-INF/MyTagLib.tld, which contains

<?xml version="1.0" encoding="UTF-8"?>  
<taglib>  
<tlibversion>1.0</tlibversion>  
<jspversion>1.1</jspversion>  
<shortname>MyTagLib</shortname>  
<info>My own TagLib</info>  
<uri>http://test.com/tags</uri>  
<tag>  
<name>mytag</name>  
<tagclass>com.test.tags.MyTag</tagclass>  
<info>My Tag</info>  
</tag>  
</taglib>

/com/test/tags/MyTag.class

In my web project I have put the jar file in /WEB-INF/lib (it is there after deployment, too).
My jsp file contains (among other things):

<%@ taglib uri="http://test.com/tags" prefix="MyTagLib" %>  
<MyTagLib:mytag>

When deployed on a Tomcat 6, the page goes:

The absolute URI: http://test.com/tags cannot be resolved in either web.xml or the jar files deployed with this application

I have tried to put a <taglib> in my web.xml linking the URI with /WEB-INF/MyTagLib.tld, but then it goes:

File "/WEB-INF/MyTagLib.tld" not found

What am I doing wrong?

Was it helpful?

Solution

Once again, I figured it out immediately after posting the question:

The tld file goes in /META-INF within the jar file, then it works fine.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top