A while back I blogged about using an annotated constraint behavior to limit input in Wicket TextFields based on domain model annotations (http://blog.armstrongconsulting.com/?p=22). So if we annotate our domain models as follows: [sourcecode language=”java”] @Length(max = 40) private String firstName; [/sourcecode] that gets automatically be translated into a maxlength=40 attribute on any text field bound to firstName (we use a form visitor on a custom form class to add the behavior to all text fields in the form). That’s pretty cool, but unfortunately, it only works for text inputs because textarea doesn’t support the maxlength attribute. This really bothered me because its really important to limit the length of textareas since that’s where people try to paste in huge blocks[…]

When I started with Wicket, I remember fighting with CheckBoxMultipleChoice for hours trying to get it to work. I just used it again today and was surprised at how easy it is to use once you’re familiar with how Wicket works. So for anyone struggling with it, here’s how to do it. Say we want to display a list of Projects associated with a User and we want to do it with the CheckBoxMultipleChoice. The projects which the user currently has access to should be checked initially. Checking or unchecking boxes will add or remove access to projects. You can accomplish this with the following code: [sourcecode language=”java”] add(new CheckBoxMultipleChoice(“projects”, new Model(userProjects), allProjects)); [/sourcecode] Assuming you have a span with[…]