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.
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.
* 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.
* 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.
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.
* Swing-like code
* Front-end only
* No HTML required
* Impressive component library
* Lack of common framework features such as binding and validation
* No internationalisation support
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.
This [Echo] is a straightforward and easy-to-use front-end-focused framework with a slick look and feel.Andre van der Schyff is a senior developer at DVT.
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.
JSF, Wicket, Cocoon, Click, WingS
* 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
* 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 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.
* 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
* Clear separation of concerns
* 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.
Andre van der Schyff has been a senior developer at jCentric for the past three years, consulting to TradeStream as a senior developer and team lead, developing supply chain management solutions. He has come to specialise in creating rich client and Web-based enterprise systems using open frameworks such as Spring and Hibernate, employing agile development methodologies such as XP. Prior to that, Van der Schyff worked on Java programming projects for various corporations after teaching a Java course at Hatfield Business College in 2001 on behalf of employer Telkom. The telco then moved Van der Schyff to his first enterprise Java project developing a new online billing system. That work experience coincided with his studies through the University of South Africa (Unisa), where he completed a BSc (Hons) Information Systems in 2004, after becoming a Sun Certified Java Programmer in 2002 and completing his graduate degree at the University of Pretoria in 2000.