I am using the Apache MyFaces Commons Validator TagLib.
How should i add this to my web.xml? The commons JAR is downloaded and resolved through Maven.
XHTML (I think this is correct):
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.prime.com.tr/ui"
**xmlns:mcv="http://myfaces.apache.org/commons/validators"**>
web.xml:
<context-param>
<!-- To add additional tab libs -->
<param-name>facelets.LIBRARIES</param-name>
<param-value>??.xml</param-value>
</context-param>
EDIT: The reason why i got to this step is because that i have tried to referenced the Maven dependency incorrectly, and in doing so, i tried to download the jar off Apache and hosted it from my own repository manager. The jar i tried to host on my own did not contain the taglib jar.
After getting the dependency correctly, everything works as per normal, there was no need to explicitly define the taglib as what balusC commended. Thankx!
<dependency>
<groupId>org.apache.myfaces.commons</groupId>
<artifactId>myfaces-commons</artifactId>
<version>1.1.2</version>
</dependency>
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 theMETA-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.