adam bien's blog

Which Java Web Framework To Choose? The Client- vs. Server-Centric Story 📎

Web frameworks are sometimes compared using their components and L&F as main criteria. Visual appeal as a differentiator, however, is not critical for productivity. Before you are going to look at the components, you should rather more deeply think about the user interactions.

In case your application consists of a set of wizard-like forms (page flow) with validated input fields, data binding and server side validation will increase your productivity and reduce the complexity of the application.

On the other hand, office-like applications with longer "offline" periods do not require fine grained interactions with the server and can live entirely at the client side.

Client-centric web frameworks are covering the latter case. With web frameworks like GWT you don't even have to interact with the server. Your entire code is translated into JavaScript and lives self-contained in the browser. With GWT it is very convenient to build one-page, offline, office-like applications with only little communication with the server required. zkoss follows similar architecture, but supports data binding and is so server-centric as well. Because a client-centric framework is entirely executed on the client it should not consume any resources (CPU / memory) on the server.

Server-centric frameworks keep a component UI tree on the server. The state of input fields and UI components are synchronized with the server side representation for your. Usually you get data binding for free and can easily perform server side validations as well as, access any backend services. Serverside validation is implemented in Java and is easier unit testable. In addition, client side validation can be implemented to avoid server round trips.

The strength of the server-centric frameworks is built-in fine grained data binding and server side validation as well as conditional page flow. Naturally a server side framework is less convenient to build offline, office like applications with a considerable amount of client code. JavaServer Faces, Wicket, Tapestry, Vaadin are some examples for server side frameworks.

Because a server-centric framework is going to be executed on the server, it will consume a considerable amount of CPU and memory.

Using GWT for a form-based wizard with lots of server side validation will require you to write some RPC code, and for the implementation of an offline single-page HTML 5 application you will have to write a considerable amount of JavaScript. Both approaches are doable, but why? :-)

See you at Java EE UI Workshop at MUC Airport!