Search code examples
javajsptaglibearjboss-4.2.x

JSP taglib in a JAR file packaged in an EAR file


I have the following situation:

  • taglib.jar: A custom JSP taglib packaged as a JAR file. The TLD file is /META-INF/taglib.tld.
  • webapp.war: A web application with JSP files that use the tags provided by taglib.jar.
  • app.ear: A J2EE application which contains webapp.war and other WAR files.

I want to package a single taglib.jar in app.ear so the JSP files in webapp.war and the other WAR files can all use its tags. I tried the following directives in the JSP files, without success:

  • <%@ taglib uri="/taglib.jar" prefix="xxx" %>
  • <%@ taglib uri="taglib.jar" prefix="xxx" %>

Is it possible to package the JSP taglib JAR file in an EAR file? If yes, which value should I specify in the uri attribute of the taglib directive?

Note: I could of course package taglib.jar in the /WEB-INF/lib of each WAR file, but that is just what I try to avoid.

Context: I deploy the EAR file on JBoss 4.2.3.

Edit: I'm afraid this is impossible, especially since I read the section about skinny WARs from the Maven WAR plugin documentation:

Sometimes a list of JARs must be packaged into the WAR (...) in order for it to work properly, like with tag libraries.


Solution

  • This is not possible. The best I could do is to package taglib.jar in the EAR file, and duplicate the TLD file in the /WEB-INF directory of each WAR file.