How to reference Facelets taglib in JAR from Facelets and web.xml?

落花浮王杯 提交于 2019-12-03 14:36:18

The *.taglib.xml file of that library is already in /META-INF of the JAR. You don't need to add anything to your web.xml. If the JAR is in webapp's runtime classpath, the taglibs will be auto-discovered. See also chapter 10.3.2 of the JSF 2 specification:

10.3.2 Facelet Tag Library mechanism

...

The run time must support two modes of discovery for Facelet tag library descriptors

  • Via declaration in the web.xml, as specified in Section 11.1.3 “Application Configuration Parameters”

  • Via auto discovery by placing the tag library discriptor file within a jar on the web application classpath, naming the file so that it ends with “.taglib.xml”, without the quotes, and placing the file in the META-INF directory in the jar file.

...

So all you need to make sure is that the JAR is indeed in the webapp's runtime classpath -which is usually the /WEB-INF/lib folder.

If you're having a problem with using that library, it's caused by something else than you think.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!