One of the compelling features in Rails is the ease with which forms for creating/editting/updating/deleteting objects can be created. Tapestry has a lot of power under the hood with respect to forms, but it still doesn't come cheap enough out of the box. A centerpiece of Trails is a component that builds a full form for editting an arbitrary object. This idea has resurfaced as a new standalone component, BeanForm.
Just plug the following into your page's HTML template:
<span jwcid="@bf:BeanForm" bean="ognl:pojo" save="listener:save" delete="listener:delete"/>
BeanForm will build a complete form from this, adapting to each individual property's type. If you are using EJB3 or Hibernate annotations, BeanForm will pick up those annotations to build out appropriate client- and server-side validations.
And its extremely extensible and customizable even beyond that. Cudos to Daniel Gredler for putting this together.
2 comments:
Maybe this is already planned, but it would be very cool if you included EJB3 and Hibernate validation support for all components in Tapestry 5.
I've started a project not so long time ago, that implements the functionality you've mentioned.
Its not even a beta, but you can check it out and see the demo (it should work).
The project is here: http://code.google.com/p/webbeans/
I've started a blog (its on Russian, yet) but the work is in progress.
Giving names to the components is still opened and @BeanEditor and @XsltBeanEditor is subject to change. I guess it should be @AsHtml (which is the functionality you want to implement with @BeanForm) and @AsXml that may layout pojo's form with XSLT.
Could you please look at it and tell your opinion about it (I know its not ready yet and in very beginning of its life, but still.. :)
I think it would be great if some of its functionality (basically XML&XSLT) would find its reflection in your @BeanForm component or its descendants and becomes a part of core Tapestry Framework.
Cheers
Post a Comment