Hi,
I have a class-level annotation of a List of the same contraint, like this: @IfFieldHasValueThenFilled.List( { @IfFieldHasValueThenFilled(field = "salutation", value = "company", mustBeFilled = "company"), @IfFieldHasValueThenFilled(field = "salutation", value = "company", mustBeFilled = "ustIDNumber"), @IfFieldHasValueThenFilled(field = "salutation", value = "company", mustBeFilled = "taxNumber", })
The constraint gets validated as intended, with the message read from the key IfFieldHasValueThenFilled.myBeanName
However, I'd like to set individual messages for the 3 constraints of the list - e.g. if company is not filled, show a different message then when taxNumber is not filled.
Is that possible? If so, how?
I have tried setting a message with the individual constraints (like @IfFieldHasValueThenFilled(field = "salutation", value = "company", mustBeFilled = "company", message = "${companymessage}"), but it does not work, it always shows the message for the costraint annotation type. (I use the validator in a spring mvc application, and use a custom class declared as a spring MessageSource)
Any help is much appreciated.
Elmar
|