Hello all im trying to make simple taglib but when i try to run it im geting error
my taglib.tld look like :
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE taglib
PUBLIC "-//Sun Microsystems, Inc.//DTD
JSP Tag Library 1.2//EN"
"http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd">
<taglib>
<tlibversion>1.0</tlibversion>
<shortname></shortname>
<tag>
<name>myTag</name>
<tagclass>com.brainysoftware.MyCustomTag</tagclass>
</tag>
</taglib>
and my web.xml looks like this :
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<display-name>template</display-name>
<taglib>
<taglib-uri>/myTLD</taglib-uri>
<taglib-location>/WEB-INF/taglib.tld</taglib-location>
</taglib>
</web-app>
and my
java file looks like this :
package com.brainysoftware;
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
public class MyCustomTag extends TagSupport {
public int doEndTag() throws JspException {
JspWriter out = pageContext.getOut();
try {
out.println("Hello from the custom tag.");
}
catch (Exception e) {
}
return super.doEndTag();
}
}
simple i know ..
but still im geting the error :
org.apache.jasper.JasperException: XML parsing error on file /WEB-INF/taglib.tld: (line 6, col 16): Element type "tlibversion" must be declared.
when i try to brows to the jsp file that looks like this :
<%@ taglib uri="/myTLD" prefix="easy"%>
<easy:myTag/>
what im doing wrong here?