When using a custom taglib in a JSP, what is cause of the exception ( org.apache.jasper.JasperException: Unable to open taglibrary http://www.yourcompany.com/taglibs : null?

Heng Cao


Steps to create custom tag in Tomcat:

1. Change $WEB_APP/WEB-INF/web.xml, add <taglib> section to it, it provide a mapping between URI and .TLD file.

2. Create or update tag-lib descriptor file(.TLD), and put it in directory or sub directory of $WEB_APP(caused by URI and .TLD mapping used .TLD relative path)

3. Create a Java class derived from TagSupport or BodyTagSupport

4. Create a class derived from TagExtraInfo, it provides attributes information of tag.

5. Put the classes file or or .jar/.zip file in CLASSPATH environment variable.

6. Restart Tomcat.

If you use a 3rd party tag library, steps 3 and 4 are not necessary. If 1, 2 or 5 are missing, Tomcat cannot find your tag lib/tag class/tld file, and a JasperException will be thrown.

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

 

 

 

 

 


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

 

 

About | Sitemap | Contact