What are the different ways of declaring a tag library to use from a JSP? Which methods are compatible from any JSP container?
Created May 7, 2012
Dominique Plante Use one of the following directives in test.jsp to refer to ha.tld:
In this case, the taglib declaration in web.xml would look like:
In this case, the taglib declaration in web.xml would look like:
In this case, nothing is needed in web.xml to refer to ha.jar
Case 1:
<%@ taglib uri="/WEB-INF/ha.tld" prefix="ha" %>
In this case, the taglib declaration in web.xml would look like:
<taglib> <taglib-uri>/WEB-INF/ha.tld</taglib-uri> <taglib-location>/WEB-INF/ha.tld</taglib-location> </taglib>
Case 2:
<%@ taglib uri="/ha.tld" prefix="ha" %>
In this case, the taglib declaration in web.xml would look like:
<taglib> <taglib-uri>/ha.tld</taglib-uri> <taglib-location>/WEB-INF/ha.tld</taglib-location> </taglib>
Case 3:
<%@ taglib uri="/WEB-INF/lib/ha.jar" prefix="ha" %>
In this case, nothing is needed in web.xml to refer to ha.jar
Note: my testing was done using Tomcat 4.0.4 beta 3