Geertjan's Blog

  • October 9, 2005

Wicket -- 'Er Komt Veel Bij Kijken'

Geertjan Wielenga
Product Manager
In Dutch, when you say 'er komt veel bij kijken', you mean something like: "There's a lot of stuff that comes around for a look." You really need to be on your toes when you first start working with this framework, but the more you get into it, the more you realize that Wicket gives you a lot more than just (a) freedom from all those XML configuration files (like in Struts and JSF) and (b) a separation of concerns (because someone could be working completely independently on the HTML while you're coding the Java side). What I mean is this—once you bite the bullet and really start pushing yourself into Wicket, you begin to discover how much freedom you have, how cool and simple it really is (once you get past some of the things that at first seem weird), and how nice it is to be working with something that is so light weight.

My first real introduction into the world of Wicket consists of a simple questionnaire:

Once you've made your choices and click Continue, you get this in a new page:

It's really simple, but the nice thing is that the values aren't specified in the HTML page. Instead, they're in the HTML pages' accompanying Java classes. (In other words, the first HTML page has a Java class that creates the components in the HTML page and adds their values. The same for the second HTML page.) Plus I added a border (which is a big deal in Wicket and the cause of a lot of confusion, when you browse the Wicket mailing lists, but, again, is really cool once you understand it). The border also consists of a Java class accompanied by an HTML page. But, once you've defined it, you can use it and use it and use it again, in every HTML page, so that you end up with a uniform look. Another thing that's cool is that you can create a class that defines what each web page should consist of—a kind of superclass that subclasses Wicket's WebPage class—which your other classes can then reuse, by subclassing your superclass. This sharing and reuse makes Wicket really powerful and can result in pretty short source files. So, anyway, this is what my project looks like in NetBeans IDE 5.0:

And these are the two resources that helped me immeasurably (and should be framed and hung on every Wicket developer's bedroom wall):

A First Look at the Wicket Framework

Consistent page layout using borders

Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.