JSF, Struts and Tooling

[Infragistics] Jess Chadwick / Friday, November 09, 2007

Struts and Faces are two J2EE frameworks that offer similar facilities. Struts arrived first and was eagerly picked up by companies developing large scale J2EE apps. Faces came along later with abilities that overlapped Struts in many places, but with a stronger focus on the presentation layer. Many development teams who had already commited to Struts chose to ignore JSF for three simple reasons:

  • Faces would require recoding on similar functionality
  • Learning curve
  • Faces emphasizes the front-end which many developers feel is covered adequately by HTML

But Faces offers several important advantages over Struts. These are:

  • JSF provides better separation between the presentation and the model. In Struts your model data is loaded into Struts-specific ActionForms. In JSF this data is loaded into plain old Java beans.
  • JSF allows several events handlers per page: Struts allows only one.
  • Struts and JSF employ similar XML based methods for page navigation. However JSF does not couple navigation to a specific server-side Action. This makes navigation more flexible and maintainable.
  • Although Struts provides some basic tag libraries, these really just encapsulate HTML tags into the Struts framework. JSF is designed to make the development of sophisticated custom tags easy.
  • JSF provides the notion of a "render kit" which means that if you need to adapt your application to display in a different context (say a cell phone instead
For more detail on these points see this article from Roland Barcia of Forrester.