Wicket Adventures

While the World Wide Web has been around for a long time, it seems like building web applications is still difficult. The problem, one has to write glue code to handle a lot of plumbing. I decided to try Wicket and I believe there a number of good features about it. It leaves logic out of the web page so that web page designers can do their job and programmers can do theirs. I bought the book titled Wicket in Action by Martijn Dashortst and Eelco Hillenius. It has a series of examples, but they are bundled into one giant application. At the same time, Maven provides an archetype that will build the basic layout and structure for a Wicket project. When I started with a base Wicket application from Maven, I was at a loss as how to get the example code from the book working. Here are my results. If the authors do a second edition, I hope they bridge this gap.

In order to use the example code, you need two things: one, maven and two, a java compiler. To use maven, either apt-get install it or download it. To see if both are working do the following.

$ javac -version
javac 1.6.0_25
$ mvn
<You should see some output here>

Now, just download each of the zip files. To run it, do the following:

$ mvn jetty:run

Point your web browser to http://localhost:8080 and you are good to go.

You can also import the project into Eclipse. First, make sure that you have the Maven plugin. Then, go to File->Import… Existing Project and select the project directory. If you want to make a war file for any of the sample projects, do the following:

$ mvn package

The resulting war file will be in the target directory.

I put together projects that deal with and only with the concepts presented. These examples are from Chapter 3 that uses the Cheesr application.


This code just does the basic layout using the Index.html as the main page, the Cheesr*.java classes to support the application. If you run it, you will get just the logo. But, it is a good starting point.


This adds the items to the page and the simple cart concept.


This adds the CheckOut panel and the checkout page. I also added a separate callback class for the add link. All the examples I have seen in the book contain anonymous inline classes (AIC). The downside is if you use the same logic in two different areas, you have to cut and paste. With a separate class, you can do code reuse. Plus, AICs look weird. Anyway, this is the demo of a separate callback the panel in addition to the checkout code. I like the Cheesr code. You can really see the power of Wicket.


About Brian Lavender

I like to program in C++, Java, and Pascal. I have an admiration for languages like Pascal, Ada, and Eiffel. I work a lot with GNU/Linux systems.
This entry was posted in Wicket. Bookmark the permalink.