You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Christian Dutaret <cd...@gmail.com> on 2014/09/04 10:12:28 UTC

JSR-303 Bean validation messages

Hi list,

When using JSR-303 annotations to validate domain objects,
tapoestry-beanvalidator builds the validation message through a call to the
JSR-303 implementation message interpolator, and then prepends the field
name.
For instance for a @NotNull annotation, the default message provided by the
message interpolator is "must not be null", if I apply it to a field named
firstName then the resulting message will be "first name must not be null".
I understand from the source code that this (the field name being
prepended) cannot be customized.
Although this works with most default interpolator messages, it does not
allow for much message customization, especially for some non-english
languages.

I use JSR-303 to be able to validate the fields consistently in the UI as
well as in other data inputs (e.g. web services). So if I wish to customize
my firstName validation message to e.g. "you must provide a value for first
name", I can't do it with tapestry-beanvalidator implementation.

The workaround I found is to specify blank labels, but then I lose some
nice Tapestry features.

Is there any other way I can achieve this?

Thx
Christian