Advertise on ITWeb         Tue, 21 Nov, 02:45:49 AM

Industry Insight

From ZK to Wicket

ZK allows for rapid application development, and Wicket supports full unit testing of the front-end.

In the previous Industry Insight in this series, I looked at a number of the Java Web frameworks available on the market. In this Industry Insight, I'll consider ZK and Echo, and begin looking at component-based frameworks.

ZK

This is a mature and impressive Ajax-based framework. The front-end can be written with XML, HTML mixed with XML, pure Java, or anything in between, as each of ZK's XML tags is backed by a Java class.

The big advantage of this is that the Java classes can be extended with ease to create additional functionality in a very intuitive way; in fact, this is the standard way of creating a controller for a particular component or window.

This approach gives developers a great degree of freedom to use powerful techniques such as wiring services and adding logic into custom-written components that can then behave in specialised ways. This framework allows for very rapid application development, as the XML mark-up typically replaces a lot of code and the framework lends itself well to reuse.

Strengths:

* XML mark-up translates directly to Java code, so developers can use either mark-up or code. The XML mark-up is typically more brief and readable, but Java code allows complete flexibility.
* Commonly needed features such as binding and validation.
* Will feel familiar to users of MVC frameworks.
* Rich component library.
* Allows mixing with plain HTML.

Weaknesses:

* Has a dual licence – free for open source, but it can be costly for commercial applications.
* Has some rendering issues, which can be difficult to work around.

Echo

This is a straightforward and easy-to-use front-end-focused framework with a slick look and feel. Echo gives developers a Web front-end that is developed almost exactly like a Swing application. It consists largely of input and layout components, and does not try to provide many additional features such as binding, validation and internationalisation. This could make it an attractive option to replace existing Swing applications.

Strengths:

* Swing-like code
* Front-end only
* No HTML required
* Impressive component library

Weaknesses:

* Lack of common framework features such as binding and validation
* No internationalisation support

Component-based frameworks

General description:

One of the key features of this group of frameworks is that they provide a component library, which the framework users can contribute to and extend. The variety of components available and their ease of use is a key (but not the only!) factor in choosing a framework from this group.

Polished

This [Echo] is a straightforward and easy-to-use front-end-focused framework with a slick look and feel.

Another factor is the level of difficulty involved in putting together, re-using and extending the page components. The components are added to HTML-like templates such as JSP or Freemarker or other framework-specific templates, by the developer. These frameworks are used widely.

Frameworks:

JSF, Wicket, Cocoon, Click, WingS

Advantages:

* Widely used and understood
* Highly flexible
* Easy to style
* Fairly portable due to use of HTML
* Design work can often be done by a separate team

Disadvantages:

* Components can be difficult to customise or write from scratch.
* Framework-specific complexities may require a fairly steep learning curve.

When to use these frameworks:

* If an application uses a fairly standard set of components such as form inputs, tables, trees and tabbed panels.
* If there are many similar-looking screens or require a high level of re-use.
* If there's a need for richer front-end functionality than the straightforward binding and page flow provided by simple MVC.

Wicket

Wicket is an innovative framework with an active following and community on Apache. Form handling is not request/response driven, the model object is kept up-to-date by the framework and logic is executed by an event-driven model.

The front-end templates are close to plain HTML and keep a very strict separation between presentation and logic by not allowing any control structures or tag libraries. All form building and business logic is done with Java code. The framework also has a consistent and simple, yet powerful approach to Ajax that can be used to implement almost any functionality. It also supports full unit testing of the front-end including Ajax calls.

Strengths:

* Simple but powerful Ajax capabilities
* Full front-end testing out of the box
* Simple Spring integration
* Built-in binding and validation
* Highly portable and customisable due to plain HTML mark-up
* Easy-to-use third-party JavaScript libraries
* Lightweight JavaScript and CSS inclusion mechanism with header contributors
* Clear separation of concerns

Weaknesses:

* Still fairly new, so community-contributed component libraries are not mature or well organised.
* Short but steep learning curve.
* Careless front-end design can cause memory overhead on the server as state is maintained to an extent.

In the next Industry Insight, I'll look at JSF and classic MVC frameworks.

* Andre van der Schyff is a senior developer at DVT.


Our comments policy does not allow anonymous postings. Read the policy here




 

 

 

Sponsors Message