I’m using JSF 2 with my own built facelet tags and I have that tags defined in taglib files, named xxxx.taglib.xml. The project is divided in war modules, which are merged by Maven when it’s built. So each project has his own taglibs and I want to have all of them in the resulting project. So that’s the question, is there a way to use a wildcard to have access to every taglib files using a single expression in web.xml? Similar to that:
<context-param>
<param-name>facelets.LIBRARIES</param-name>
<param-value>classpath*:**/*.taglib.xml</param-value>
</context-param>
That should load every file which ends with .taglib.xml from /WEB-INF/classes directory, but it’s not working. I’m using Tomcat 6. What am I missing?
This is not valid syntax. It has to be webcontent-relative paths, semicolonseparated. Your project and module/build setup is likely not entirely right.
Just create a standalone Java project which ends up as JAR in
/WEB-INF/liband put the taglib file in/META-INFfolder. JSF will also scan every single JAR in/WEB-INF/libif there’s a/META-INF/*.taglib.xmland then auto-register it. You don’t need afacelets.LIBRARIEScontext param for this. Put web resources like XHTML files in/META-INF/resourcesfolder. Note that this is also exactly how component libraries like PrimeFaces works.You may probably need to change Maven to fix the wrong build approach. It should build JARs of module projects and put them in
/WEB-INF/libof the target WAR file and absolutely not merge/overlay the loose files from separate projects in one big/WEB-INF/classesfolder.By the way, the
facelets.LIBRARIESis Facelets 1.x specific and deprecated in JSF 2.x. Use insteadjavax.faces.FACELETS_LIBRARIES.See also: