What are the different ways of declaring a tag library to use from a JSP? Which methods are compatible from any JSP container?

Dominique Plante

Use one of the following directives in test.jsp to refer to ha.tld:

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

0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact