我检出了Grails: How to combine domain objects' errors with command objects' errors?,但由于某些原因,解决方案对我而言不起作用。这可能只适用于Grails 1.3.7而不适用于Grails 2.2.1。Grails - 组合命令对象和子对象中的错误
我有一个包含InnerObjectCommand列表的命令对象OuterObjectCommand。我在控制器中手动填充它,然后调用验证。在OuterObjectCommand上调用validate()似乎不验证InnerObjectCommand列表,因此我分别验证列表中的所有元素。我想要做的是将InnerObjectCommand对象和OuterObjectCommand对象的所有错误添加到flash.errors中。我怎样才能做到这一点?
您是否尝试过使用自定义[验证](http://grails.org/doc/latest/ref/Constraints/validator.html)外部命令对象会显式验证内部命令对象? – dmahapatro
我不知道该怎么写。 static constraints = {innerObjectCommand validator:{it.validate(); ??? } – Anonymous1