I assume that you are not using a real Java EE application server, such as WildFly , TomEE , GlassFish , etc., but a barebones JSP / Servlet container, such as Tomcat , which really does not come with JSF out of the box, and you had to manually install it . Otherwise, all this fuss with the JAR is not needed.
Is it jsf-api or jsf-impl? Or should we include both?
You need both. jsf-api.jar contains APIs that almost exclusively abstract classes and interfaces exist. These are the javax.faces.* Types that you import and use in your code. jsf-impl.jar contains an implementation that exists from real hard working code. The implementation is internally loaded through factories in the API. These are the com.sun.faces.* Classes that you should not import and use directly in your code. If you do this, you will not be able to switch to another JSF implementation, such as MyFaces.
And if so, why aren't they combined?
There is a unified JAR, javax.faces.jar . You can choose this option instead of two free JARs. Just go to the Download section of the Mojarra Home Page to find a link to the Maven repository with javax.faces.jar files. Currently, the latest version is Mojarra 2.2.11 , so select javax.faces-2.2.11.jar .
See also:
source share