gpt4 book ai didi

grails - 将PropertyEditor关联到特定 Controller

转载 作者:行者123 更新时间:2023-12-02 15:03:14 28 4
gpt4 key购买 nike

有没有一种方法可以将PropertyEditor关联到特定的Controller。

我可能想为DateTime类使用两个PropertyEditor,并将它们与不同的 Controller 关联。

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

最佳答案

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

registry.registerCustomEditor(Date.class, 'startDate', new MyDateAddressEditor())

从Grails 1.3.6开始可以使用。

关于grails - 将PropertyEditor关联到特定 Controller ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4511050/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com