Quick take at Wicket Web Beans
Published by peter September 13th, 2007 in java, wicket, wwb.Recently a really interesting wicket extension emerged: Wicket Web Beans (WWB).
Wicket Web Beans (WWB) is an Apache Wicket component toolkit for displaying and editing POJOs that conform to the JavaBeans specification. Web pages are automatically generated based on bean properties and certain conventions. If necessary, the layout, editability, and actions of these pages can be customized on an exception basis. In other words, the toolkit normally does what you'd expect, but when it doesn't, you can override its behavior.
I clicked through the introduction to see how WWB works.
To edit properties of a POJO you actually don't have to do anything; a simple form is generated. If setters are not present for a property no input field is generated.
To customize the layout WWB introduces a properties flle with a simple DSL to go with the bean (same name, ends with beanprops). The syntax is simple (and a bit similar to YAML):
-
# Customize TestBean.
-
TestBean {
-
cols: 1;
-
props: firstName, lastName, operand1, operand2, result, -number;
-
}
This file tells WWB : whenever you see a TestBean bean, lay it out in a one-column grid ("cols: 1") and display the properties ("props") in the order specified. Note that you refer to JavaBean properties without the prefix of "get", "set", or "is" and the first character is lower case. Also in the "props" parameter, we say "-number". This tells WWB to remove the "number" property from the page.
Personally I think this is a bit clumsy: the layout configuration is about the same amount of code needed to actually write your entire model in Grails.
But this isn't where it stops. WWB is quite extensive, one can add all sorts of components/widgets like calendars, tables etc. to the form definition.
Potentially WWB could be very powerful, but I really think that the introduction of a separate file/DSL won't increase the transparency of the application. I'll be sticking to Grails for now!




















Com'on Peter. I know you better then to say 'I'll stay away from Wicket because this WWB is no good and I know Grails better'!
Still, I agree that introducing a separate language for WWB is doubtful. I like the control I have in Wicket projects; its all in the language (which is plain xhtml plain java in Wicket). I doubt I'll start using WWB soon.
@erikvanoosten Don't get me wrong... I won't stay away from Wicket due to the fact that I know Grails better. I just think that the solution for form generation provided by WWB is way less elegant then the way this is handled by Grails. And yes... I'm comparing apples and orages
I just might have a look at Wicket itself AFTER the battle of the geeks...!