reset password
Author Message
abhishek_sharma
Posts: 79
Posted 14:52 Nov 08, 2012 |

In my Spring MVC , maven project ; I want to create a Custom Tag. This is what I did so far. Created a Class extends TagSupport then I have a abhi.tld file

<?xml version="1.0" encoding="UTF-8" ?>
<taglib xmlns="http://java.sun.caom/xml/ns/j2ee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_1.xsd"
    version="2.1">
    
    <uri>http://localhost:8080/abhi</uri>
    <tlibversion>1.0</tlibversion>
    <jspversion>2.0</jspversion>
    <display-name>Abhi Tags</display-name>

    <tag>
        <name>imageCount</name>
        <tagClass>abhi.web.taghandlers.ImageCountTag</tagClass>
        <info>Image Count Function</info>
        <attribute>
            <name>type</name>
            <required>true</required>
        </attribute>
        <attribute>
            <name>value</name>
            <required>true</required>
        </attribute>
    </tag>
</taglib>

In JSP I am getting this warning

The tag handler class for "custom:imageCount" (null) was not found on the Java Build Path

Can anyone give any idea what am I doing wrong

 


 

cysun
Posts: 2935
Posted 15:09 Nov 08, 2012 |

I had a similar error before, but I don't remember how I fixed it. Most likely it has something to do with the tld file. In particular, in Taglib 2.1 XML schema (as specified in your <taglib>), <tlibversion> should be <tlib-version>, and <jspversion> is no longer supported.

abhishek_sharma
Posts: 79
Posted 15:31 Nov 08, 2012 |

No longer showing that warning I changes <tagClass> to <tagclass>


But still not working. Do I need to defined it in Web.xml?

cysun
Posts: 2935
Posted 15:34 Nov 08, 2012 |
abhishek_sharma wrote:

No longer showing that warning I changes <tagClass> to <tagclass>


But still not working. Do I need to defined it in Web.xml?

It should be <tag-class>. See http://docs.oracle.com/javaee/5/tutorial/doc/bnamu.html.