Grails Date Binding

In Grails, you can "bindData" in the controller:

Book b = new Book() bindData(b, params) 

What if I have a date field with a specific format (e.g. yyyy-MM-dd) from user input? In Spring, we can use registerCustomEditor (). How about Grails?

+4
source share
2 answers

With Grails 1.1.1, you can implement PropertyEditorRegistrar and use this to specify the format. See http://grails.1312388.n4.nabble.com/Grails-1-1-1-change-in-binding-date-properties-td1323105.html

+3
source

Have you already encountered Extended Data Binding Plugin ?

From the documentation on the site, both aspects that you have in mind seem to be offered

  • Allow the DataBinder to be configured to analyze user input and populate objects (usually domain objects) using special PropertyEditors both at the application level and at the controller level. as String.

  • Extend controllers with dynamic methods to provide data binding and bean wrapping.

+1
source

All Articles