Hi,
Just reviewing old things, I discovered I didn't answer you. The think
is that the same effect can be obtained using the already existing
functionality. I can create the following annotation to validate a field:
@RequiredStringValidator(type = ValidatorType.SIMPLE, fieldName =
"phoneCountryCode",
messageParams={"getText('PhoneCountryCode.label')"},key
= "validation-error.mandatory")},
And then define the following i18n properties
PhoneCountryCode.label = Country Code
validation-error.mandatory = The field {0} is mandatory
And then the generated message will be "The field Country Code is
mandatory". So I'm going to close this issue, as it is no longer a problem.
Best regards and thanks
JL
2013/9/30 Lukasz Lenart <[email protected]>
> 2013/9/25 JOSE L MARTINEZ-AVIAL <[email protected]>:
> > Well, I have found a workaround that is not much of a hacking. The
> > annotations has a messageParameters that is evaluated against the
> > valuestack. Since the action is in the valuestack, and it implements
> > ActionSupport,I can pass a parameter that is a call to getText.
> >
> > requiredStrings =
> > {@RequiredStringValidator(type = ValidatorType.SIMPLE,
> > messageParams={"getText('email')"},
> > fieldName = "event.email", key =
> > "validation-error.mandatory")},
> >
> > and by defining the message as:
> >
> > validation-error.mandatory = The field {0} is mandatory
> > email = E-mail
>
> I'm not sure if I get you right - does it meet your requirements or do
> you expect something different?
>
>
> Regards
> --
> Ćukasz
> + 48 606 323 122 http://www.lenart.org.pl/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>