ysatnaf
ysatnaf

Reputation: 31

Can tld files be accessed from WEB-INF\lib\{*.jar}\META-INF\resources\WEB-INF directory?

I have a jsp file which include a tag like:

<%@ taglib prefix="abc" uri="/WEB-INF/tlds/xyz.tld" %>

and in my app, the deploy structure is:

WEB-INF
  |-lib
      |-some.jar
          |-META-INF
              |-resources
                  |-WEB-INF
                      |-tlds
                          |-xyz.tld

this works fine in Tomcat 7, but when I deploy my app to JBoss as 7, it can not find the tld file.

so, is it an issue of JBoss(not support Servlet3.0?) or the tld files just can not accessed from META-INF\resources\WEB-INF directory in a jar?

Upvotes: 3

Views: 2236

Answers (1)

Steve C
Steve C

Reputation: 19445

This is not a Servlet 3.0 issue, it's a JSP 2.2 question. (They're different specifications).

The uri portion of the taglib declaration is not a location. It is a key and must correspond to the content of the

<uri>your/tld/uri</uri>

element in the tld file.

If this element is missing then you must declare it in a taglib map in the web.xml, providing the uri there:

<jsp-config>
     <taglib>
         <taglib-uri>/WEB-INF/tlds/xyz.tld</taglib-uri>
         <taglib-location>/WEB-INF/lib/some.jar/META-INF/resources/WEB-INF/tlds/xyz.tld</taglib-location>
     </taglib>
</jsp-config>

Upvotes: 4

Related Questions