Which framework should I choose - Seam, Wicket, JSF or GWT?

karl picture karl · Apr 13, 2009 · Viewed 31k times · Source

I'm debating whether to use Seam, Wicket, JSF or GWT as the foundation for my presentation layer in a Java project.

I narrowed my selection of Java web frameworks down to this subset based on job market considerations, newness of the technology and recommendations from other S.O. users.

What factors should I take into consideration in deciding among these?

Answer

Miguel Ping picture Miguel Ping · Aug 31, 2010

I've used GWT since version 1.4 and JSF since the 2.0 spec came out.

GWT is a client-side framework, it generates JavaScript from Java. Your architecture would be a pure client-server, which means:

  • Best to use coarse-grained services
  • All objects that travel to the client side should be fully serializable (it means there's no lazy load, or OpenSessionInView pattern)
  • Since GWT 2.0 you can design your gui using xhtml, which is much easier in regards to styling & structuring HTML
  • GWT tends to favour good architecture, if you mess it up it will be bad to refactor
  • Perfect History (browser back button, bookmarkable urls) support is hard, you probably have to roll your own, although it's easy to hack something right up front

JSF is a component-based framework, with a view-first design (code-behind if you like):

  • It's easier to do some type of webapps (stateful, like shopping cart)
  • JSF+Seam have suport for conversations (think wizard-like pages that maintain state across several pages)
  • You can implement OpenSessionInView, depending on your stack. It's probably not recommended if you use EJB for service/business layer
  • JSF2 has superb support for AJAX, and with a component suite like RichFaces you can build nice webapps
    • But if you want exquisite javascript behaviour, you'll have to write some javascript
  • JSF tracks the current UI state in client or server-side. This is a tradeoff between network traffic or server memory.

Resume:

  • GWT is more adequate for web applications (think gmail) that require the best client-side performance. It's easy to write custom components (you write Java) and since your server-side is just a service layer you can be fully stateless on the server side.
  • JSF is more adequate for mostly CRUD applications that are better suited for component-oriented stuff: think a hotel/flight reservation system, an online store with a shopping cart, etc