I am starting on JSF2.0 I used a tutorial as a reference but I have the following question:
The tutorial used 2 libs only: jsf-api.jar
, jsf-impl.jar
(but also had JSTL) from Mojarra Project.
I tried to dowload them also but seems the site is not reachable.
So I used Apache MyFaces but to run the example I had to add 8 jars (commons-*
, myfaces-*
).
Why do I need more jars if I use MyFaces? Should I prefer Mojarra as lighter? Also the download page is indeed JSF Mojarra?
Thanks
Why do I need more jars if I use MyFaces?
Because those commons-*
dependencies are not bundled in MyFaces. On the other hand, if you're using other libraries from Apache.org which also use those commons-*
dependencies, then you ultimately end up with smaller total size libraries.
Noted should be that since Mojarra 2.1.6 a single JAR file format is available as javax.faces.jar
which is since Mojarra 2.3.9 renamed to jakarta.faces.jar
.
Should I prefer Mojarra as lighter
This is a non-argument. You should look at how robust and well maintained the JSF implementation is.
The grandfather of Mojarra, Sun JSF RI 1.0, and the early versions of RI 1.1 were cluttered by nasty bugs. At that moment (around 2004-2006), MyFaces was definitely the more stable alternative.
Since 1.1_02 and 1.2_02 around early 2006 the new Sun/Oracle JSF dev team did great work. Not only with bugfixing, but also with performance enhancements. About halfway the Mojarra 1.2 lifetime (around 2007-2009), Mojarra was the better choice than MyFaces.
Since JSF 2.0, which came with new partial state saving management, MyFaces was performance wise the better choice due to a different and much more efficient approach of calculating state deltas, particularly when using large component trees. Mojarra caught up only since version 2.1.22. During the 2.0/2.1 timeline, Mojarra had only serious issues with <ui:repeat>
in complex/nested compositions (a.o. broken state saving, processing only last iterated form, failed <f:ajax>
, etc) and with flash scope implementation (initial implementation was totally not bullet proof). MyFaces also had its own set of bugs, but they were manageable.
Right now, with JSF 2.2, one can't really say beforehand which one is better. Bugs often expose only later and robustness can only be evaluated during the aftermath. Just pick whatever implementation you "feel" is the best. Browse through their issue reports (MyFaces and Mojarra) to learn about the previously fixed issues and the currently open issues. If you encounter a specific bug, try with both implementations to exclude the one and other. Report if necessary to keep the overall quality of the both implementations high.
Also the download page is indeed JSF Mojarra?
Their homepage has been moved around several times. Currently (Nov 2019) it's located at https://eclipse-ee4j.github.io/mojarra. You can find the libraries in org.glassfish:jakarta.faces
in Maven Central too. You can find the source code in eclipse-ee4j/mojarra
project in GitHub.