Hi Christian,
I recommend that you have a closer look at the specification documents for
JSR 303 (Bean Validation) and
JSR 314 (JSF 2). They are well written and provide a lot of related information. Also Hibernate Validator's
reference guide might be helpful for you.
To answer you questions:
1.) BV (and HV as its reference implementation) is a generic validation API which is not tied to any application layer. So using messages defined by one specific GUI framwork/API would not work. For instance you could use BV in a back-end application, where no GUI layer is around at all.
2.) Are you referring to JSF here? In this case you can have the field names in the messages by providing a message for the key "javax.faces.validator.BeanValidator.MESSAGE" in one of you JSF app's message bundles. In this message the field name can be referenced by the placeholder {1}, the actual validation message by {0}:
Code:
javax.faces.validator.BeanValidator.MESSAGE={1}: {0}
See the JSF 2.0 spec, section 3.5.6.3 for more information.
3.) As BV/HV is layer-agnostic it is not aware of framework-specific descriptors such as faces-config.xml. By default custom validation messages are retrieved from a bundle named ValidationMessages (see the
HV reference guide), but if required you can also customize that by providing you own
MessageInterpolator.
Gunnar