开发者

Clarifying understanding of JSF 2.0

Before I delve into JSF 2.0 I want to clarify my understanding of JSF 2.0 by finding 开发者_如何学Goanswers to the following:

  1. What are the differences between the reference implementation and MyFaces?

  2. Can jsf 2.0 with either reference implementation or MyFaces be deployed on any servlet container, i.e. tomcat/jetty, or must it be deployed only on a Java EE compliant container?

  3. How difficult is it to create custom tags? For example a pagination link tag, similar to what is available in Grails?

  4. Is it possible to use *Faces (i.e. PrimeFaces, RichFaces, etc) with a javascript library like jquery or yui? Are any conflicts created by doing so?


1: What are the differences between the reference implementation and MyFaces?

They are developed by different teams. Since both are supposed to adhere the JSF 2.0 spec, there ought to be no differences with regard to the base functionality as specified in JSF 2.0 spec. However, with regard to exposed and fixed bugs, there may be differences. My personal preference is Mojarra (the reference implementation).

2: Can jsf 2.0 with either reference implementation or MyFaces be deployed on any servlet container, i.e. tomcat/jetty, or must it be deployed only on a Java EE compliant container?

Yes. JSF 2.0 only requires a minimum of Servlet 2.5 API. So any Servlet 2.5 compatible container or even Java EE 5 applicationserver suffices. You may only need to disable the builtin JSF 1.2 API in a Java EE 5 applicationserver whenever you want to use JSF 2.0. Or, better, just use a Java EE 6 application server (Glassfish 3, JBoss AS 6, etc) since it already ships with JSF 2.0.

3: How difficult is it to create custom tags? For example a pagination link tag, similar to what is available in Grails?

When using Facelets as view technology (by default used in JSF 2.0), this should be relatively simple with a template or a composite component. Since it's basically just XML, no Java code is necessary.

4: Is it possible to use *Faces (i.e. PrimeFaces, RichFaces, etc) with a javascript library like jquery or yui? Are any conflicts created by doing so?

Even more, both PrimeFaces and RichFaces ships with jQuery (UI) builtin and PrimeFaces also YUI. That's also where they get their fancy look'n'feel and/or special effects from. As to conflicts with own jQuery scripts, just use jQuery.noConflict() to suppress it.


When you're ready to dive in JSF 2.0, I can recommend the following tutorials:

  • My JSF 2.0 tutorial with Eclipse and Glassfish
  • Mkyong.com JSF 2.0 tutorials/references
  • Coreservlets.com JSF 2.0 tutorial

Update as per the comment:

However, could you elaborate on why your personal preference is Mojarra (the reference implementation)?

Because I am an avid user of Mojarra. True, it's subjective :)

Objectively said, MyFaces was the better choice during JSF RI 1.1 times. Less bugs and better performance. However, since the new JSF RI dev team during the JSF RI 1.2 times, a lot was improved/fixed. As of now there are no technical reasons to prefer the one over the other. It's at highest the degree of exposed and fixed bugs (maintenance/support).

Related questions:

  • MyFaces 1.2 causes Tomcat 6 to crash
  • Memory leaks in MyFaces 2.0
  • Intermittent ViewExpiredException in MyFaces 2.0
  • Mojarra or MyFaces?
  • Disadvantages of JSF 2.0 (a bit of history)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜