9

Just a general question, open for discussion...

I'm very much liking JSF so far, I'm new to it, but I prefer it to Struts. From a professionals standpoint, do you see a strong future for JSF ? Is it worth an investment as a young programmer to learn JSF 2.0 over Struts or another similar framework ? Should I stick to regular JSP ? Is Ajax really simpler through JQuery than JSF ?

I like new technologies and I like what I see so far from JSF but I want to be practical as well, and a lot Google searches turn up some bluntly critical comments about JSF 2.0.

Thoughts ?

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
JHarnach
  • 3,944
  • 7
  • 43
  • 48

1 Answers1

19

Comparing JSF with Struts is like comparing apples with oranges. Struts is a request/action based MVC framework while JSF is a component based MVC framework. Struts is also aged. In the IT you're supposed to keep moving. Generally, a component based MVC framework is seen as a further evolution of a request/action based MVC framework.

JSF is currently already used very widely. It has indeed received a lot of critism before. You can read about most of them in the question What are the main disadvantages of JSF 2.0? The strength of JSF is mainly being a Java EE maintained standard and the availability of relatively a lot of 3rd party component libraries (PrimeFaces, RichFaces, IceFaces, OpenFaces, Tomahawk, etc). With JSF, it's very easy to develop CRUD applications and web forms with nice look'n'feel quickly.

However when it goes into the complex, JSF may cause some unforeseen surprises. Although the JSF specification and reference implementation (Mojarra) is pretty mature since the latest 1.2 builds, you may encounter some very specific behavioral problems which goes against your intuition. Some are just "by design" and can only be understood when you understand in detail how JSF works under the covers which in turn often boils down to the stateless nature of the HTTP protocol. JSF abstracts it in essence "too much" away that you don't see it anymore. Some are just bugs in the 3rd party component libraries used, but that's thus not strictly JSF-implementation-specific. Bug/issue handling is however pretty good in most of the major component libraries -if you report the bugs timely.

As to ajaxical stuff, JSF 2.0 indeed provides very little manual control over manually firing ajaxical requests and controlling the view tree in both server and client side. Simply because it's a component based MVC framework which keeps the tree state at the both sides. You've got to take the both sides into account when taking the ajaxical works in your own hands. If you really need more freedom in ajax/request based actions, then a component based MVC framework is simply the wrong choice. You should pick a request/action based MVC framework instead like Spring MVC, Struts or Stripes, along with a JS library like jQuery. You however have to write lot of HTML/CSS/JS boilerplate yourself instead.

Community
  • 1
  • 1
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
  • I didn't know Ed Burns was Struts commiter. Thanks for the info. – amorfis Nov 04 '10 at 09:06
  • This is a good read, points me in the right direction I think. Thanks !. – JHarnach Nov 04 '10 at 14:45
  • BTW I just realized I've been reading YOUR blogs at http://balusc.blogspot.com/ religiously for the past few weeks, VERY helpful! – JHarnach Nov 04 '10 at 14:47
  • 2
    You're welcome. I must however admit that my blogs really need updated articles targeted on JSF 2.0. I've to find some time yet .. :/ – BalusC Nov 04 '10 at 15:02
  • 1
    Wasn't Craig R. McClanahan the guy Sun hired to initially create the new component based MVC framework that was to become JSF? I did notice there was a guy called Ed Burns who's listed as a documentation contributor at: http://struts.apache.org/1.1/volunteers.html. One big name in the JSF scene who was listed as a source code contributor for Struts is James Holmes. On this bio page of Ed Burns I don't see Struts being mentioned either: http://ridingthecrest.com/edburns/resume/bio.html but maybe he committed only some minor things? – Arjan Tijms Dec 28 '10 at 17:22
  • @arjan: oh yes, you're right. I must have confused him with someone else. – BalusC Dec 28 '10 at 18:05