将PropertyEditor与特定的Controller相关联

时间:2010-12-22 16:03:40

标签: grails propertyeditor

有没有办法将PropertyEditor与特定的Controller相关联。

我可能想要为DateTime类安装两个PropertyEditor,并希望将它们与不同的控制器关联。

或具有2个日期字段的域类,一个需要更改2010-12-23到目前为止,另一个需要2010-12-23 10:00:01

1 个答案:

答案 0 :(得分:3)

无法与Controller关联。 PropertyEditorRegistrar只有registerCustomEditor()的两个签名:整个属性类和属性名称。 第二个签名在Grails 1.3.6之前无效,这是一个错误GRAILS-6592。 所以

registry.registerCustomEditor(Date.class, 'startDate', new MyDateAddressEditor())
自Grails 1.3.6起,

将起作用。