Wicket
I recently used wicket to knock up a simple web shop example for our ExproRetail product and found it to be a fairly pleasant experience.
Wicket is (yet another) Java web framework but it distinguishes itself from many others with the following features:
- No XML configuration
- Very clean page templates
- High level of abstraction - User code rarely has to refer to HTTP concepts
Writing a Wicket app is rather more like writing an event-based desktop application than a web application. For example, to render a link and react when it’s clicked all that’s needed is:
In the template:
<a wicket:id="mylink">Click me</a>
In the code:
add(new Link("mylink") {
public void onClick() {
// Do something when link clicked...
}
});
Similarly, to handle a form submission you could create a TextField, give it a model to read/write its data to and add it to a Form. In either case there is no need to worry about constructing specific URLs, query parameters, HTML escaping etc.
Templates are just standard XHTML with a sprinkling of wicket attributes. When Wicket renders the template and encounters a wicket:id it looks for a matching component to render the tagged element. This is a simple and powerful system very similar to that used by the Python web kit nevow.
Wicket also makes it very easy to create custom “widgets”: Simply extend from an appropriate subclass of Component and provide a snippet of XHTML (if needed). To use your widget, all that’s needed is a simple add(new YourComponent(...)).
With version 1.2 there’s lots of AJAXy goodness too but I’ve yet to try this myself and the docs seem to be slipping behind a little.
The downside to all this convenience, at least for any reasonably busy site, is that Wicket stores a lot of state in user sessions. Some of the time gained letting Wicket manage everything may be lost ensuring that session usage is kept under control.
2 comments July 6th, 2006 mporter