Jeff's Blog

Developing Great Software

Sunday, August 14, 2011

Apache Wicket Interfaces & Methods To Master – An Introduction

The Apache Wicket Web framework is the best thing that’s ever happened to Java based Web development. That’s a bold statement and obviously my opinion but there appears to be a growing consensus in that area as more Java developers are exposed to this fabulous framework (I’ll address my concern of what I perceive as a very poor attempt to promote Wicket in a later blurb or two or future article).

One of the joys of working with Wicket is, of course, that developing with Wicket means developing with Java, HTML, CSS and Javascript. By some, though, this is seen as one of Wicket’s greatest weaknesses and those who shun this pure or clean approach the loudest tend to be those who prefer to work with visual, development-time components that are common to various other frameworks such as JSF. Their argument, however, tends to fall upon deaf ears by those of us who have ever worked on either a corporate or commercial Web project of even medium size and complexity.

Perhaps the biggest single hurdle that budding Wicket developers face is mastering the various Java interfaces, classes and methods that are required to pull everything together in a Wicket application. Most Web applications have to deal with memory, sessions, security (restricting access to resources to authenticated and authorized users), file (resource) contribution, AJAX behaviors and request handlers, code reuse, etc. These are very common concerns every Web developer addresses yet the implementation of some of these concerns aren't well documented or have little if no example code to demonstrate how to address them using Wicket.

As a result, a Wicket ‘newbie’ is typically left dumbfounded when first contemplating addressing these concerns for the first time in their own Wicket applications. This is unfortunate and unnecessary because all these issues are addressed by Wicket’s numerous interfaces and mentods that it exposes. The problem is that numerous important interfaces and methods are either not well documented or they lack valuable example code which would serve to provide a context for their use.

In the articles to come I will attempt to unravel, explore and promote the use of some of these interfaces and methods and provide numerous examples of their use. To begin I’ll start with the various ways that a Wicket developer can employ Javascript and Ajax on their pages. I'll discuss the basics such as how a component can contribute Javascript to a page, how to handle callbacks to the component listeners and how to render Javascript that is called by Wicket's Ajax library before and after it calls the Ajax request's component listener.

I’ll be using NetbBeans 7 throughout the articles to develop the code because in my opinion no other IDE provides the level of support for Wicket development that NetBeans and its Wicket plugin does. If you haven’t already, download and install NetBeans 7 and then install the latest release of the Wicket plugin; both can be found by visiting http://netbeans.org/. If you would like to learn about the numerous productivity enhancing features provided by the latest release of the Wicket plugin and how to install it please read my article at http://jeff-schwartz.blogspot.com/2011/04/netbeans-7-wicket-plugin.html.

UPDATED 8/14/2011
This and all future related articles on Wicket will now appear at my new blog site The Wicket Evangelist.

About Me

My photo
New York, NY, United States
Software Developer