Bean Fields, a new plugin for Grails, provides a suite of tags for rendering form fields for domain and command objects. As the developers claim, it takes the pain, boredom and scope for error away.

Out of the box it:

  • renders a field using a UI element appropriate for the property type. Constraints are used to set maximum lengths etc.
  • automatically renders  tags for fields, from i18n message bundles
  • renders „required“ indicators if the field is nullable:false and/or blank:false
  • renders errors adjacent to the field that had the error
  • renders the current value as appropriate

This is all done by building on top of Grails existing tags, so all the regular tag attributes are supported where possible.

Here’s an example of how you can render all this for a bunch of bean properties:

You can find more elaborate examples as well as instructions for use on the plugin page.