
We continue our series of interviews with Wicket community members. This time we flew to Rio de Janeiro to meet Bruno Borges. Bruno is a software engineer who has been active in our community for a while now and has contributed to the Wicket Stuff Hibernate Validator integration. I’m looking forward to meeting Bruno at ApacheCon US but you’ll have to do with this interview.
Ajax in Wicket is great, for the most part its usage is transparent and things work as you would expect. Where Ajax does not work perfectly, yet, is when it comes to partially updating repeaters. The problem is that repeater components do not have a markup tag of their own and so Wicket cannot transparently figure out where the updates should go.
Consider a simple case of a repeater rendering a list of contacts. Wicket markup looks like this:
1 2 3 4 5 6 7 | <body>
<table>
<tr wicket:id="contacts">
<td><span wicket:id="name"></span></td>
</tr>
</table>
</body> |
And the rendered markup looks like this:
1 2 3 4 5 6 | <body> <table> <tr><td><span>Lisa Simpson</span></td></tr> <tr><td><span>Bart Simpson</span></td></tr> </table> </body> |
As you can see, if we add a new item to the ListView and try to repaint it via Ajax there is no root markup tag for the Wicket Ajax to replace. This is why it is necessary to add the repeater to a container and then repaint the container instead. In this case we would add a WebMarkupContainer to the table tag and repaint it via Ajax instead. This, however, will result in all table rows being rendered and sent over from server to client, which for a lot of cases is undesirable.
It is not too hard to support the usecase of “I added something new to the repeater and want to have just that row added via Ajax”. The trick is to give Wicket a tag to repaint via Ajax which can be accomplished by doing the following:
Accomplishing this is pretty easy. Suppose we create the new item by submitting a form via an AjaxButton:
form.add(new AjaxButton("submit") { @Override protected void onSubmit(AjaxRequestTarget target, Form< ? > f) { // retrieve the newly added contact bean Contact contact = form.getModelObject(); // add it to the collection on serverside contacts.add(contact); // create the new repeater item and add it to the repeater Component item = buildItem(contact); // first execute javascript which creates a placeholder tag in markup for this item target.prependJavascript( String.format( "var item=document.createElement('%s');item.id='%s';"+ "Wicket.$('%s').appendChild(item);", "tr", item.getMarkupId(), container.getMarkupId())); // notice how we set the newly created item tag's id to that of the newly created // Wicket component, this is what will link this markup tag to Wicket component // during Ajax repaint // all thats left is to repaint the new item via Ajax target.addComponent(item); } });
When the form is submitted using the above AjaxButton only the newly added item is repainted via Ajax instead of the entire table. A functional project is attached below.
This concept can be taken to the next level where a repeater can be “synced” with the markup on the client side. This would involve:
Maybe next time :)
Sample project: partialajax.zip
The Apache Wicket team is proud to announce the availability of the fifth maintenance release: Apache Wicket 1.3.5. A lot of bugs have been squashed and several improvements implemented. It is recommended you update to Wicket 1.3.5 at your earliest convenience.
Eager people click here to download the distribution, others can read further:
We thank you for your patience and support.
- The Wicket Team
Jonathan Locke was kind enough to spot a physical copy of Wicket in Action in a Barnes and Noble book store. I never thought that having a physical copy of a book would be so rewarding and make the book that more real. Writing a book, getting it published by a publisher and seeing it in stores is something really special that can’t be captured in words. It is bigger than writing your thesis. I’m not sure if it is more rewarding than writing your weekly TPS report though.
Now if I can find my stapler… I must have left it somewhere… Milton!!!!!
A common question on Wicket mailing lists is “Why doesn’t my ListView work as expected in a Form?”. There can be many possible answers, but the core issue is that ListView was never designed to work as a form component. ListView is great when it comes to displaying a list of elements, but in order to be a good citizen in Wicket’s form processing a list editor should possess the following features:
Surprisingly, implementing such a component is trivial. We will start by implementing the ListEditor itself and its one supporting class: ListItem, and later move on to implementing a Remove button. As always the fully functional sample project will be attached at the bottom.
Read the rest of this entry »

The first victim in our "Meet the Wicket Community" series is Nino Martinez Wael. Nino is a very vocal contributor to our community, and one of the most active folks on the mailing list, and probably responsible for about half the projects on the Wicket Stuff project. His latest community effort is establishing the Wicket merchandise shop. I'm looking forward to meeting Nino at Øredev in Malmö in November. Being such a visible member of our community, I wanted Nino to be the first interviewee.
A big thank you goes to Nino for being so quick with his answers. Let's get started with the first interview!
As a new item for this blog, I’m going to publish a series of interviews I’m conducting with Wicket community members. I think these interviews can be very interesting for the grander community, as they will unveil the dirty little secrets of your co-community members. Of course the interviews will be mostly focussed on the relationship the interviewee has with Wicket, but I’m not adverse to asking a bit further than that.
The first interview I’ll publish was done with Nino Martinez Wael, and I have a couple more being processed. I’m aiming to publish an interview every week or so as long as I have willing victims. You are of course invited to ask more questions to our guests.
Nino Wael has re-opened the Wicket merchandise shop. Now you can wear Wicket to work, the gym or when dining out. There’s a cap for those that are hair growth impaired, and a mug for those with severe caffeine deficiency. Grab your Wicket gear now!
The 50 fastest growing technology companies in the Netherlands is a competition where the relative revenue growth over the last 5 years are taken into account and companies ranked accordingly.
In 2004 my company (Topicus) was number 1, even above tomtom. Even after 4 years we are still in the top 50 of fastest growing companies in the Netherlands and can now use the title of “Sustainable Grower”. This is a great testatement to the management and employees of Topicus.
Even though this is something special, I’d like to point out that at least 4 companies in the fast 50 are using Wicket in their day to day business: Topicus, Servoy (#8 in the top 50, congratulations!), Xebia and Hippo. In my not so humble opinion, using Wicket gives them a competitive advantage. The fact that Topicus is the Sustainable Grower (Topicus is a long time supporter and contributor to Wicket) provides ample evidence.
Long story short: Wicket is good for our companies, why don’t you use it yet?
In the application I am currently working on it is quiet common to have plugins which affect the UI in different ways. Because of Wicket’s component and OO nature it is very easy to build such functionality. In this article we are going to build a simple application that allows the user to create an article and configure how it should be deployed. Out of the box we are going to support a fictional FTP and HTTP POST deployers, each with their own configuration data and editors. We are going to abstract the deployer into a plugin system so new ones can be easily created and added to the application. The sample project provided works with Hibernate, Spring, and Wicket. In the end we will end up with something like the screenshots below. Notice that the UI is different based on which deployer type is selected in the dropdown…
With this book, Wicket will become the greatest territory the Dutch have settled since Manhattan.
Nathan Hamblen
Senior Software Engineer, Teachscape Inc.
This is the complete and authoritative guide to Wicket, written and reviewed by the core members of the Apache Wicket team. If there's anything you want to know about Wicket, you are sure to find it in this book.
Jonathan Locke
Founder and Architect of Apache Wicket, Foreword Wicket in Action
Without question, Wicket in Action... is the be-all and end-all when it comes to Wicket.
Geertjan Wielenga, Wicket Netbeans Plugin Author
The tutorial and conversational tone of the writing makes the book very approachable.
Nick Heudecker
System Mobile
Loved the sample application—it tied everything together.
Phil Hanna
Senior Software Developer, SAS Institute
The essential guide for learning and using Wicket.
Erik van Oosten
Lead programmer and Project Manager, JTeam
Finally, the Web Framework of web frameworks, Apache Wicket, now has a bible of its own.
Per Ejeklint
Senior Software Architect, Heimore group
Wicket is an innovative evolution of the MVC programming with simple roots, but without a primer such as this, it can be more challenging than it needs to be.
Brian Topping
Founder, Bill2 Inc.
Wicket In Action glues the areas of web development with Apache Wicket together and gives a great overview of Apache Wicket...it will make a great compendium.
Nino Martinez Wael
Java Specialist, Jayway Denmark